summaryrefslogtreecommitdiffstats
path: root/subcmds/upload.py
Commit message (Collapse)AuthorAgeFilesLines
...
* | Fix a bug in repo upload --cbrBryan Jacobs2013-06-021-0/+2
|/ | | | | | | repo upload --cbr bailed out if some branches did not have modifications when it is used. Change-Id: I35f264ff7d77bb4bf8f26b4c3faffa184920b6c5
* Send reviews to a different branch from fetchBryan Jacobs2013-05-241-2/+7
| | | | | | | | This adds the ability to have reviews pushed to a different branch from the one on which changes are based. This is useful for "gateway" systems without smartsync. Change-Id: I3a8a0fabcaf6055e62d3fb55f89c944e2f81569f
* Move Python version checking to a separate moduleDavid Pursehouse2013-05-231-3/+4
| | | | | | | | | | | | | | | | | Add a new module with methods for checking the Python version. Instead of handling Python3 imports with try...except blocks, first check the python version and then import the relevant modules. This makes the code a bit cleaner and will result in less diff when/if we remove support for Python < 3 later. Use the same mechanism to handle `input` vs. `raw_input` and add suppression of pylint warnings caused by redefinition of the built-in method `input`. Change-Id: Ia403e525b88d77640a741ac50382146e7d635924 Also-by: Chirayu Desai <cdesai@cyanogenmod.org> Signed-off-by: Chirayu Desai <cdesai@cyanogenmod.org>
* Some fixes for supporting python3Chirayu Desai2013-04-181-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix imports. * Use python3 syntax. * Wrap map() calls with list(). * Use list() only wherever needed. (Thanks Conley!) * Fix dictionary iteration methods (s/iteritems/items/). * Make use of sorted() in appropriate places * Use iterators directly in the loop. * Don't use .keys() wherever it isn't needed. * Use sys.maxsize instead of sys.maxint TODO: * Make repo work fully with python3. :) Some of this was done by the '2to3' tool [1], by applying the needed fixes in a way that doesn't break compatibility with python2. Links: [1]: http://docs.python.org/2/library/2to3.html Change-Id: Ibdf3bf9a530d716db905733cb9bfef83a48820f7 Signed-off-by: Chirayu Desai <cdesai@cyanogenmod.org>
* Fix: Missing spaces in printed messagesDavid Pursehouse2013-03-051-2/+2
| | | | | | | | | | | | | | | | | | | | | Several messages are printed with the `print` method and the message is split across two lines, i.e.: print('This is a message split' 'across two source code lines') Which causes the message to be printed as: This is a message splitacross two source code lines Add a space at the end of the first line before the line break: print('This is a message split ' 'across two source code lines' Also correct a minor spelling mistake. Change-Id: Ib98d93fcfb98d78f48025fcc428b6661380cff79
* Tidy up code formatting a bit moreDavid Pursehouse2012-11-141-2/+2
| | | | | | | | | | | | Enable the following Pylint warnings: C0322: Operator not preceded by a space C0323: Operator not followed by a space C0324: Comma not followed by a space And make the necessary fixes. Change-Id: I74d74283ad5138cbaf28d492b18614eb355ff9fe
* Fix inconsistent indentationDavid Pursehouse2012-11-141-19/+19
| | | | | | | | | | The repo coding style is to indent at 2 characters, but there are many places where this is not followed. Enable pylint warning "W0311: Bad indentation" and make sure all indentation is at multiples of 2 characters. Change-Id: I68f0f64470789ce2429ab11104d15d380a63e6a8
* Change print statements to work in python3Sarah Owens2012-11-131-18/+23
| | | | | | This is part of a series of changes to introduce Python3 support. Change-Id: I373be5de7141aa127d7debdbce1df39148dbec32
* Convert prompt answers to lower case before checkingDavid Pursehouse2012-11-141-2/+2
| | | | | | | | When prompting for yes/no answers, convert the answer to lower case before comparing. This makes it easier to catch answers like "Yes", "yes", and "YES" with a comparison only for "yes". Change-Id: I06da8281cec81a7438ebb46ddaf3344d12abe1eb
* Even more coding style cleanupDavid Pursehouse2012-10-301-1/+1
| | | | | | | | | | | Fixing some more pylint warnings: W1401: Anomalous backslash in string W0623: Redefining name 'name' from outer scope W0702: No exception type(s) specified E0102: name: function already defined line n Change-Id: I5afcdb4771ce210390a79981937806e30900a93c
* Use modern Python exception syntaxSarah Owens2012-10-231-2/+2
| | | | | | | | | | | "except Exception as e" instead of "except Exception, e" This is part of a transition to supporting Python 3. Python >= 2.6 support "as" syntax. Note: this removes Python 2.5 support. Change-Id: I309599f3981bba2b46111c43102bee38ff132803
* Coding style cleanupDavid Pursehouse2012-10-091-10/+10
| | | | | | | | | | | | | | | Fix the following issues reported by pylint: C0321: More than one statement on a single line W0622: Redefining built-in 'name' W0612: Unused variable 'name' W0613: Unused argument 'name' W0102: Dangerous default value 'value' as argument W0105: String statement has no effect Also fixed a few cases of inconsistent indentation. Change-Id: Ie0db839e7c57d576cff12d8c055fe87030d00744
* upload: add --draft option.Brian Harring2012-07-281-1/+4
| | | | Change-Id: I6967ff2f8163cd4116027b3f15ddb36875942af4
* repo: Add option review.URL.uploadtopic supportv1.9.2Anthony Russello2012-06-051-0/+13
| | | | | | | | | | | | This patch adds the option to include topic branches by adding the following to a .gitconfig file: uploadtopic = true This option is only read in when the -t option is not already specified at the command line. Change-Id: I0e0eea49438bb4e4a21c2ac5bd498b68b5a9a845
* New flag for repo upload: --current_branch (--cbr)Daniel Sandler2012-04-061-1/+8
| | | | | | | | | | A convenient equivalent to `repo upload --br=<current git branch>`. Note that the head branch will be selected for each project uploaded by repo, so different branches may be uploaded for different projects. Change-Id: I10ad8ceaa63f055105c2d847c6e329fa4226dbaf
* Added remote destination branch information when uploading.Christer Fletcher2011-11-291-3/+4
| | | | | | | | | | Several times one have done an upload only to later notice in gerrit that the upload was done to the wrong branch as the git has not yet been branched for the current git. This change will make repo print what the destination branch is when asking the user if she wants to go through with the upload. Change-Id: Ia9c3a92a6a04c022edfebf4f8d651ac062bb1f3b
* repo: capitalize default prompt charMike Frysinger2011-11-291-3/+3
| | | | | | | | | It is common in command line tools to indicate what the default answer will be if the user simply hits enter. In repo, the display is just "y/n" with no indication as to which is the default. So change the n to N in the messages since that is how repo operates. Change-Id: I81819ae630355072eb0365e59168b0921289498f
* Fixed UnicodeDecodeError while uploading changes.chenguodong2011-11-291-0/+5
| | | | | | | | | | | | | | | When commit with comment that has non-ASCII characters, UnicodeDecodeError will be raised while uploading multiple project/branch changes. Because some strings in script are not str type, but unicode. So all the strings are decoded to unicode, and python use ascii to do this, it can not decode non-ASCII characters, so UnicodeDecodeError raised. Signed-off-by: chenguodong <chenguodong@huawei.com> Change-Id: I46447f489a4b9760a5899c7ba9d764b688594e46
* Add branch support to repo uploadMandeep Singh Baines2011-05-261-1/+8
| | | | | | | | | | | | | | | | This commit adds a --br=<branch> option to repo upload. repo currently examines every non-published branch. This is problematic for my workflow. I have many branches in my kernel tree. Many of these branches are based off of upstream remotes (I have many remotes) and will never be uploaded (they'll get sent upstream as a patch). Having repo scan these branches adds to my upload processing time and clutters the branch selection buffer. I've also seen repo get confused when one of my branches is 1000s of commits different from m/master. Change-Id: I68fa18951ea59ba373277b57ffcaf8cddd7e7a40
* Support repo-level pre-upload hook and prep for future hooks.v1.7.4Doug Anderson2011-03-111-6/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All repo-level hooks are expected to live in a single project at the top level of that project. The name of the hooks project is provided in the manifest.xml. The manifest also lists which hooks are enabled to make it obvious if a file somehow failed to sync down (or got deleted). Before running any hook, we will prompt the user to make sure that it is OK. A user can deny running the hook, allow once, or allow "forever" (until hooks change). This tries to keep with the git spirit of not automatically running anything on the user's computer that got synced down. Note that individual repo commands can add always options to avoid these prompts as they see fit (see below for the 'upload' options). When hooks are run, they are loaded into the current interpreter (the one running repo) and their main() function is run. This mechanism is used (instead of using subprocess) to make it easier to expand to a richer hook interface in the future. During loading, the interpreter's sys.path is updated to contain the directory containing the hooks so that hooks can be split into multiple files. The upload command has two options that control hook behavior: - no-verify=False, verify=False (DEFAULT): If stdout is a tty, can prompt about running upload hooks if needed. If user denies running hooks, the upload is cancelled. If stdout is not a tty and we would need to prompt about upload hooks, upload is cancelled. - no-verify=False, verify=True: Always run upload hooks with no prompt. - no-verify=True, verify=False: Never run upload hooks, but upload anyway (AKA bypass hooks). - no-verify=True, verify=True: Invalid Sample bit of manifest.xml code for enabling hooks (assumes you have a project named 'hooks' where hooks are stored): <repo-hooks in-project="hooks" enabled-list="pre-upload" /> Sample main() function in pre-upload.py in hooks directory: def main(project_list, **kwargs): print ('These projects will be uploaded: %s' % ', '.join(project_list)) print ('I am being a good boy and ignoring anything in kwargs\n' 'that I don\'t understand.') print 'I fail 50% of the time. How flaky.' if random.random() <= .5: raise Exception('Pre-upload hook failed. Have a nice day.') Change-Id: I5cefa2cd5865c72589263cf8e2f152a43c122f70
* upload: Catch and cleanly report connectivity errorsShawn O. Pearce2011-01-091-3/+7
| | | | | | | | | | | Instead of giving a Python backtrace when there is a connectivity problem during repo upload, report that we cannot access the host, and why, with a halfway decent error message. Bug: REPO-45 Change-Id: I9a45b387e86e48073a2d99bd6d594c1a7d6d99d4 Signed-off-by: Shawn O. Pearce <sop@google.com> (cherry picked from commit d2dfac81ad6a060179b4b2289060af2dc7a5cdfd)
* upload: Remove --replace optionFicus Kirkpatrick2010-10-291-77/+1
| | | | | | | It hasn't been necessary for a long time, and its functionality can be accomplished with 'git push'. Change-Id: Ic00d3adbe4cee7be3955117489c69d6e90106559
* upload: Fix --replace flagv1.6.10.2Shawn O. Pearce2010-07-161-2/+2
| | | | | | | | --replace started to fail due to a Python error, I forgot to pass through the opt structure to the replace function. Change-Id: Ifcd7a0c715c3fd9070a4c58208612a626382de35 Signed-off-by: Shawn O. Pearce <sop@google.com>
* upload: Allow review.HOST.username to override emailv1.6.10Shawn O. Pearce2010-07-151-0/+5
| | | | | | | | | | Some users might need to use a different login name than the local part of their email address for their Gerrit Code Review user account. Allow it to be overridden with the review.HOST.username configuration variable. Change-Id: I714469142ac7feadf09fee9c26680c0e09076b75 Signed-off-by: Shawn O. Pearce <sop@google.com>
* upload -t: Automatically include local branch nameShawn O. Pearce2010-07-151-9/+12
| | | | | | | | | | | If the -t flag is given to upload, the local branch name is automatically sent to Gerrit Code Review as the topic branch name for the change(s). This requires the server to be Gerrit Code Review v2.1.3-53-gd50c94e or later, which isn't widely deployed right now, so the default is opt-out. Change-Id: I034fcacb405b7cb909147152db427fe69dd7bcbf Signed-off-by: Shawn O. Pearce <sop@google.com>
* Warn users before uploading if there are local changesAnthony Newnam2010-07-151-0/+15
| | | | | Change-Id: I231d7b6a3211e9f5ec71a542a0109b0c195d5e40 Signed-off-by: Shawn O. Pearce <sop@google.com>
* upload: Automatically --cc folks in review.URL.autocopyBen Komalo2010-07-151-1/+27
| | | | | | | | | | The upload command will read review.URL.autocopy from the project's configuration and append the list of e-mails specified to the --cc argument of the upload command if a non-empty --re argument was provided. Change-Id: I2424517d17dd3444b20f0e6a003be6e70b8904f6 Signed-off-by: Shawn O. Pearce <sop@google.com>
* upload: Move confirmation threshold from 3 to 5 commitsv1.6.9.5Dan Morrill2010-05-051-1/+1
| | | | Change-Id: I7275d195cf04f02694206b9f838540b0228ff5e1
* upload: Confirm unusually large number of uploaded commitDan Morrill2010-05-041-0/+29
| | | | | | | | | Add a sentinel check to require a second explicit confirmation if the user is attempting to upload (or upload --replace) an unusually large number of commits. This may help the user to catch an accidentally incorrect rebase they had done previously. Change-Id: I12c4d102f90a631d6ad193486a70ffd520ef6ae0
* Automatically guess Gerrit change number in "repo upload --replace"v1.6.7.4Ficus Kirkpatrick2009-05-051-2/+20
| | | | | This feature only works if you have one commit to replace right now (the common case).
* Display the URL we will upload changes to for reviewShawn O. Pearce2009-04-181-1/+1
| | | | | | | | This gives the user the last chance to confirm where the change is going to be sent to. Knowing the review server URL will help the user decide if continuing with the upload makes sense. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Improve the help text for 'repo upload'Shawn O. Pearce2009-04-181-13/+17
| | | | Signed-off-by: Shawn O. Pearce <sop@google.com>
* Only compute commits in repo upload if we need to show a promptShawn O. Pearce2009-04-171-2/+3
| | | | | | | | If the user has disabled a prompt, skip the two commands we use to obtain the list of commits and the date of the branch. These will never be displayed and just waste the end-user's time. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Allow review.URL.autoupload to skip prompting during `repo upload`Shawn O. Pearce2009-04-171-12/+44
| | | | | | | | | | | | If review.URL.autoupload is set to true in a project's .git/config or in ~/.gitconfig then `repo upload` will automatically upload, and skip prompting the end-user. Conversely, if review.URL.autoupload is set to false, then repo will refuse to upload to that project. Bug: REPO-25 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Don't bother listing branch URLs during uploadShawn O. Pearce2009-03-191-3/+0
| | | | | | | | | | | Modern Gerrit2 automatically outputs the URL for each commit to stderr as it creates the records. Dumping the URL ourselves is unnecessary additional output, and worse is just an approximate guess for the correct web URL. Gerrit might not live at the top level directory for the server, or might even prefer a different hostname for web connections than what is listed in the manifest. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Describe upload --replace in upload's help textv1.4.2Shawn O. Pearce2008-12-121-0/+6
| | | | Signed-off-by: Shawn O. Pearce <sop@google.com>
* Don't accept multiple commits for the same change in upload --replaceShawn O. Pearce2008-12-121-1/+6
| | | | | | | | Gerrit won't permit more than one commit using the same change number during a replacement request, so we should error out if the user has asked for this in their upload edit script. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fix upload --replace after it was broken when --review,--cc was addedv1.4.1Shawn O. Pearce2008-11-241-2/+2
| | | | Signed-off-by: Shawn O. Pearce <sop@google.com>
* Add --review and --cc flags to repo upload, so you canJoe Onorato2008-11-191-11/+36
| | | | assign reviewers when you upload changes.
* Teach 'repo upload --replace' how to add replacement patch setsv1.3Shawn O. Pearce2008-11-121-1/+58
| | | | | | | | | | | | | | Users are prompted with the list of known changes we are about to upload, and they can fill out the current change numbers for any changes which already exist in the data store. For each of those changes the change number and commit id is sent as part of the upload request, so Gerrit can insert the new commit as a new patch set of the existing change, rather than make a new change. This facility permits developers to replace a patch so they can address comments made on a prior version of the same change. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Show which user account each change was uploaded underv1.0.3Shawn O. Pearce2008-10-221-0/+1
| | | | | | | | This way users are well aware of which account we used when the uploads are complete, so they can be certain to sign into the web application with that user identity. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Initial Contributionv1.0The Android Open Source Project2008-10-211-0/+180