summaryrefslogtreecommitdiffstats
path: root/subcmds/upload.py
Commit message (Collapse)AuthorAgeFilesLines
* upload/editor: fix bytes/string confusionMike Frysinger2019-11-161-5/+0
| | | | | | | | | | | | | | | | The upload module tries to turn the strings into bytes before passing to EditString, but it combines bytes & strings causing an error. The return value might be bytes or string, but the caller only expects a string. Lets simplify this by sticking to strings everywhere and have EditString take care of converting to/from bytes when reading/writing the underlying files. This also avoids possible locale confusion when reading the file by forcing UTF-8 everywhere. Bug: https://crbug.com/gerrit/11929 Change-Id: I07b146170c5e8b5b0500a2c79e4213cd12140a96 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/245621 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* use print() instead of sys.stdout.write()Mike Frysinger2019-07-111-5/+10
| | | | | | | | | | | | | | | | We're relying on sys.stdout.write() to flush its buffer which isn't guaranteed, and is not the case in Python 3. Change to use print() everywhere to be standard, and utilize the end= keyword to get the EOL semantics we need. We can't use print's flush= keyword as that's only in Python 3. Leave behind a TODO to clean it up when we can drop Python 2. Bug: https://crbug.com/gerrit/10418 Change-Id: I562128c7f1e6d154f4a6ecdf33a70fa2811dc2af Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/230392 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
* set default file encoding to utf-8Mike Frysinger2019-06-131-0/+1
| | | | | | | | There's no reason to support any other encoding in these files. This only affects the files themselves and not streams they open. Bug: https://crbug.com/gerrit/10418 Change-Id: I053cb40cd3666ce5c8a0689b9dd938f24ca765bf
* Add option for git-repo to support 'silent' uploadsVadim Bendebury2018-11-051-0/+4
| | | | | | | | | | | | | | | | | | | When --ne/--no-emails is added to 'repo upload' command line, gerrit server will not generate notification emails. project.py:Project.UploadForReview method is modified to accept a string recognizable by gerrit to indicate different sets of destination email addressees, but the upload command line allows only one option - disable sending emails completely. Default repo upload behavior is not being changed. TEST=tried in the Chrome OS repo, observed that patches uploaded with --ne or --no-emails indeed do not trigger any emails, while patches uploaded without these command line options still trigger email notifications. Change-Id: I0301edec984907aedac277d883bd0e6d3099aedc
* Merge "update markdown/help header format"Jonathan Nieder2018-10-101-4/+2
|\
| * update markdown/help header formatMike Frysinger2018-10-101-4/+2
| | | | | | | | | | | | | | Since gitiles recommends using # headers over ---/=== underlines, change the manifest-format.md over and all our help texts. Change-Id: I96391d41fba769e9f26870d497cf7cf01c8d8ab3
* | update homepage URIsMike Frysinger2018-10-101-1/+1
|/ | | | Change-Id: I482a72bf296978625b1e82ef580b0e0d4d57ff25
* Remove unused pylint suppressionsDavid Pursehouse2018-07-241-2/+0
| | | | | | | | | | | pylint is not used since bb5b1a0. The pyflakes cleanup mentioned in that commit has not been done, but given that this project is no longer being actively developed I don't think it's worth spending time doing it. Leaving the pylint suppressions causes confusion because it leads people to think that we are still using pylint. Change-Id: If7d9f280a0f408c780f15915ffdb80579ae21f69
* Support --push-option in upload subcommandMasaya Suzuki2017-11-131-1/+6
| | | | Change-Id: I44836f8c66ded5a96cbf5431912e027e681f6529
* Add option '--no-cert-checks' for 'upload' sub command.Łukasz Gardoń2017-08-231-1/+6
| | | | | | | This option allow to bypass verification ssl certification while establishing connection with Gerrit to upload review. Change-Id: If2e15f5a273c18a700eb5093ca8a4d5a4cbf80cd
* Revert "Migrate git-repo to create private changes rather than drafts"Jonathan Nieder2017-08-081-3/+4
| | | | | | | | This reverts commit d88f53e2b9634b9645f80b2d8e653beac24711fe. I merged it too hastily without paying enough attention to compatibility with released Gerrit versions. Change-Id: I4028d4737df1255f11e217da183a19a010597d5b
* Migrate git-repo to create private changes rather than draftsChangcheng Xiao2017-08-071-4/+3
| | | | | | | | Considering that some users might expect changes created with '-d' option are not public. Private changes may be a better choice here than work-in-progress changes. Change-Id: I46a8fb9ae38beb41cf96d6abe82bea6db2439669
* Add options for git-repo to support private and wip changesChangcheng Xiao2017-08-071-1/+12
| | | | | | | This change adds options for git-repo tool to support private changes and work-in-progress changes. Change-Id: I343491f5949f06f1580d53f9cc0dee2dca09130f
* Fix "list comprehension redefines 'x'" warnings from pyflakesDavid Pursehouse2017-07-101-2/+2
| | | | | | | | | $ git ls-files | grep py$ | xargs pyflakes subcmds/stage.py:101: list comprehension redefines 'p' from line 63 subcmds/sync.py:784: list comprehension redefines 'p' from line 664 subcmds/upload.py:467: list comprehension redefines 'avail' from line 454 Change-Id: Ia65d1a72ed185ab3357e1a91ed4450c719e75a7c
* Tell the user if it will upload a draftNicolas Cornu2017-07-101-1/+2
| | | | Change-Id: Ie004ec9d61603f3f618c47597947b82c59f2839c
* upload: short circuit when nothing is pendingMike Frysinger2016-09-141-4/+6
| | | | | | | When nothing is pending, most of this code is already short-circuited. Hoist the single check up to make this more obvious/slightly faster. Change-Id: Iec3a7e08eacd23a7c5f964900d5776bf5252c804
* RepoHook: allow users to approve hooks via manifestsMike Frysinger2016-08-161-1/+3
| | | | | | | | | | | | | | | | | | The constant prompting when registered hooks change can be tedious and has a large multiplication factor when the project is large (e.g. the AOSP). It gets worse as people want to write more checks, hooks, docs, and tests (or fix bugs), but every CL that goes in will trigger a new prompt to approve. Let's tweak our trust model when it comes to hooks. Since people start off by calling `repo init` with a URL to a manifest, and that manifest defines all the hooks, anchor trust in that. This requires that we get the manifest over a trusted link (e.g. https or ssh) so that it can't be MITM-ed. If the user chooses to use an untrusted link (e.g. git or http), then we'll fallback to the existing hash based approval. Bug: Issue 226 Change-Id: I77be9e4397383f264fcdaefb582e345ea4069a13
* upload: report names of uncommitted filesVadim Bendebury2014-10-141-2/+6
| | | | | | | | | | | | | | | | | | | | | When there are uncommitted files in the tree, 'repo upload' stops to ask if it is OK to continue, but does not report the actual names of uncommitted files. This patch adds plumbing to have the outstanding file names reported if desired. BUG=None TEST=verified that 'repo upload' properly operates with the following conditions present in the tree: . file(s) modified locally . file(s) added to index, but not committed . files not known to git . no modified files (the upload proceeds as expected) Change-Id: If65d5f8e8bcb3300c16d85dc5d7017758545f80d Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Signed-off-by: Vadim Bendebury <vbendeb@google.com>
* Define unicode as str if using Python 3Anthony King2014-05-061-2/+4
| | | | | | The unicode object was renamed to str in Python 3 Change-Id: I1e4972fb07b313d3462587b3059bb3638d779625
* Add reviewers automatically from project's git configbijia2014-03-041-3/+14
| | | | | | | | | | | The `review.URL.autocopy` setting sends email notification to the named reviewers, but does not add them as reviewer on the uploaded change. Add a new setting `review.URL.autoreviewer`. The named reviewers will be added as reviewer on the uploaded change. Change-Id: I3fddfb49edf346f8724fe15b84be8c39d43e7e65 Signed-off-by: bijia <bijia@xiaomi.com>
* Merge "Don't backtrace when current branch is not uploadable."David Pursehouse2014-01-141-1/+10
|\
| * Don't backtrace when current branch is not uploadable.Warren Turkal2013-12-111-1/+10
| | | | | | | | | | | | | | | | | | The backtrace currently occurs when one uses the "--cbr" argument with the repo upload subcommand if the current branch is not tracking an upstream branch. There may be other cases that would backtrace as well, but this is the only one I found so far. Change-Id: Ie712fbb0ce3e7fe3b72769fca89cc4c0e3d2fce0
* | Merge "repo: Support multiple branches for the same project."Conley Owens2014-01-101-1/+3
|\ \ | |/ |/|
| * repo: Support multiple branches for the same project.David James2013-10-141-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is often useful to be able to include the same project more than once, but with different branches and placed in different paths in the workspace. Add this feature. This CL adds the concept of an object directory. The object directory stores objects that can be shared amongst several working trees. For newly synced repositories, we set up the git repo now to share its objects with an object repo. Each worktree for a given repo shares objects, but has an independent set of references and branches. This ensures that repo only has to update the objects once; however the references for each worktree are updated separately. Storing the references separately is needed to ensure that commits to a branch on one worktree will not change the HEAD commits of the others. One nice side effect of sharing objects between different worktrees is that you can easily cherry-pick changes between the two worktrees without needing to fetch them. Bug: Issue 141 Change-Id: I5e2f4e1a7abb56f9d3f310fa6fd0c17019330ecd
* | Only check merge destination if it isn't Nonev1.12.6Conley Owens2013-10-151-9/+10
| | | | | | | | Change-Id: Ifb1dcd07142933489e93a1f4f03e38289087b609
* | Fix indentationv1.12.5David Pursehouse2013-10-151-7/+7
|/ | | | | | | git-repo uses 2 space indentation. A couple of recent changes introduced 4 space indentation in some modules. Change-Id: Ia4250157c1824c1b5e7d555068c4608f995be9da
* Don't upload when dest branch is not merge branchConley Owens2013-10-101-0/+29
| | | | | | | | | | | | Example: - `repo init -b master` / sync a project - In one project: `git checkout -b work origin/branch-thats-not-master` - make some changes, `git commit` - `repo upload .` - Upload will now be skipped with a warning instead of being uploaded to master Change-Id: I990b36217b75fe3c8b4d776e7fefa1c7d9ab7282
* don't pass project revision to UploadForReviewColin Cross2013-10-081-1/+1
| | | | | | | | | | | | | | | Passing a project revisionExpr to UploadForReview will cause it to try to push to refs/for/<sha> if the revision points to a sha instead of a branch. Pass None for dest_branch if no destination branch has been specified, which will cause UploadForReview to upload to the merge branch. There is room for further improvement, the user prompts will still print "Upload project <project> to remote branch <sha>", and then upload to the merge branch and not the sha, but that is the same behavior that was in 1.12.2. Change-Id: I06c510336ae67ff7e68b5b69e929693179d15c0b
* upload: fix display of destination branch for SingleBranchChirayu Desai2013-06-281-1/+1
| | | | | | | | | | The command `repo upload --cbr -D <some branch>` will display the default revision, and not the actual destination branch. Fix that and display the branch to which the change will be uploaded to. Change-Id: I712ed0871c819dce6774c47254dac4efec4532e0
* Merge "Fix a few issues with dest-branch and multiples"Conley Owens2013-06-101-2/+4
|\
| * Fix a few issues with dest-branch and multiplesBryan Jacobs2013-06-031-2/+4
| | | | | | | | | | | | | | This fixes dest-branch display with >1 branch being uploaded to at once, and correctly handles setting the target branch in that case. Change-Id: If5e9c7ece02cc0d903e2cb377485ebea73a07107
* | 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