summaryrefslogtreecommitdiffstats
path: root/subcmds/download.py
Commit message (Collapse)AuthorAgeFilesLines
* download: add a --branch optionMike Frysinger2020-03-231-1/+11
| | | | | | | | | | | This allows people to quickly create new branches when pulling down changes rather than having to juggle the git calls themselves. Bug: https://crbug.com/gerrit/11609 Change-Id: Ie6a4d05e9f4e9347fe7f7119c768e6446563ae65 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259855 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* download: unify error handling with sub git callsMike Frysinger2020-03-231-11/+21
| | | | | | | | | | | | We gracefully handle cherry-pick errors, but none of the others which means people get confusing Python tracebacks. Move the main logic in a single GitError try block so we can show pretty error messages for all of them. Change-Id: I52cdf6468d21a98de7f65b86d5267b3caabd5af8 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259854 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* download: support -x when cherry-pickingMike Frysinger2020-03-231-1/+12
| | | | | | | | | | | This is a pretty common option for people to want too use, so include it as a pass-thru option when cherry-picking. Bug: https://crbug.com/gerrit/9418 Change-Id: I2a24c1ed7544541719caa4d3c0574347a151a1b0 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259853 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* download: support --ff when cherry-pickingMike Frysinger2020-03-231-1/+1
| | | | | | | | | | | The git cherry-pick already supports this, so plumb the existing repo option down. Otherwise it's confusing when people use -c --ff and it doesn't use that behavior. Change-Id: Id68932ffa09204bb30b92a21aff185c00394a520 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259852 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* Fix blank line issues reported by flake8David Pursehouse2020-02-121-0/+1
| | | | | | | | | | | | | | | | | | | | - E301 expected 1 blank line - E302 expected 2 blank lines - E303 too many blank lines - E305 expected 2 blank lines after class or function definition - E306 expected 1 blank line before a nested definition Fixed automatically with autopep8: git ls-files | grep py$ | xargs autopep8 --in-place \ --select E301,E302,E303,E305,E306 Manually fix issues in project.py caused by misuse of block comments. Change-Id: Iee840fcaff48aae504ddac9c3e76d2acd484f6a9 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254599 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: David Pursehouse <dpursehouse@collab.net>
* Remove redundant backslashesDavid Pursehouse2020-02-121-2/+2
| | | | | | | | | | | | | | | fleka8 reports: E502 the backslash is redundant between brackets Fixed automatically with autopep8: git-repo $ git ls-files | grep py$ | xargs autopep8 --in-place --select E502 Change-Id: I1486ae1d17206918474363daf518274c5be8daed Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254602 Tested-by: David Pursehouse <dpursehouse@collab.net> Reviewed-by: Mike Frysinger <vapier@google.com>
* remove spurious +x bitsMike Frysinger2020-02-091-0/+0
| | | | | | | | | These files are not directly executable, so drop the +x bits. Change-Id: Iaf19a03a497686cc21103e7ddf08073173440dd1 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254076 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
* Pass refs to ls-remoteAkshay Verma2018-03-241-2/+3
| | | | | | This will fix the issue of parsing large output locally Change-Id: I9a5cf1238147a02c92a3fca53eab9bd57f9d16b4
* Download latest patch when no patch is specifiedAkshay Verma2018-03-171-0/+8
| | | | | | | | | | | When someone does "repo download -c <project> <change>" without specifying a patch number, by default patch 1 is downloaded. An alternative is to look for the latest patch and download the same when no explicit patch is given. This commit does the same by identifying the latest patch using "git ls-remote". Change-Id: Ia5fa7364415f53a3d9436df4643e38f3c90ded58
* download: try to choose . as default project if noneNicolas Cornu2017-07-121-2/+3
| | | | Change-Id: I28b5e3be5f3c9a4c077af87d6a3e0cc3b96a1b9d
* Exit 1 if repo download -c failsScott Anderson2014-10-171-0/+1
| | | | Change-Id: I6985548bf87032b121eeccf858c4eeca1a60598c
* Add error message for download -c conflictsRob Ward2014-02-111-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently if you run repo download -c on a change and the cherry-pick runs into a merge conflict a Traceback is produced: rob@rob-i5-lm ~/Programming/repo_test/repo1 $ repo download -c repo1 3/1 From ssh://rob-i5-lm:29418/repo1 * branch refs/changes/03/3/1 -> FETCH_HEAD error: could not apply 0c8b474... 2 hint: after resolving the conflicts, mark the corrected paths hint: with 'git add <paths>' or 'git rm <paths>' hint: and commit the result with 'git commit' Traceback (most recent call last): File "/home/rob/Programming/git-repo/main.py", line 408, in <module> _Main(sys.argv[1:]) File "/home/rob/Programming/git-repo/main.py", line 384, in _Main result = repo._Run(argv) or 0 File "/home/rob/Programming/git-repo/main.py", line 143, in _Run result = cmd.Execute(copts, cargs) File "/home/rob/Programming/git-repo/subcmds/download.py", line 90, in Execute project._CherryPick(dl.commit) File "/home/rob/Programming/git-repo/project.py", line 1943, in _CherryPick raise GitError('%s cherry-pick %s ' % (self.name, rev)) error.GitError: repo1 cherry-pick 0c8b4740f876f8f8372bbaed430f02b6ba8b1898 This amount of error message is confusing to users and has the side effect of the git message telling you the actual issue being ignored. This change introduces a message stating that the cherry-pick couldn't be completed removing the Traceback. To reproduce the issue create a change that causes a conflict with one currently in review and use repo download -c to cherry-pick the conflicting change. Change-Id: I8ddf4e0c8ad9bd04b1af5360313f67cc053f7d6a
* Tidy up code formatting a bit moreDavid Pursehouse2012-11-141-3/+3
| | | | | | | | | | | | 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
* Change print statements to work in python3Sarah Owens2012-11-131-10/+11
| | | | | | This is part of a series of changes to introduce Python3 support. Change-Id: I373be5de7141aa127d7debdbce1df39148dbec32
* Remove unused importsDavid Pursehouse2012-08-231-1/+0
| | | | | | There are several imports that are not used. Remove them. Change-Id: I2ac3be66827bd68d3faedcef7d6bbf30ea01d3f2
* repo download: add --ff-only optionPierre Tardy2012-05-241-0/+5
| | | | | | | | | | | | | | | | Allows to ff-only a gerrit patch This patch is necessary to automatically ensure that the patch will be correctly submitted on ff-only gerrit projects You can now use: repo download (--ff-only|-f) project changeid/patchnumber This is useful to automate verification of fast forward status of a patch in the context of build automation, and commit gating (e.g. buildbot) Change-Id: I403a667557a105411a633e62c8eec23d93724b43 Signed-off-by: Erwan Mahe <erwan.mahe@intel.com> Signed-off-by: Pierre Tardy <pierre.tardy@intel.com>
* repo download: add --revert optionErwan Mahe2012-05-241-1/+6
| | | | | | | | | | | | | | | | | BZ: 4779 Allows to revert a gerrit patch This patch is necessary for the on-demand creation of engineering builds using buildbot You can now use: repo download [--revert|-r project changeid/patchnumber This is useful to automate reverting of a patch in the context of build automation, and regression bisection Change-Id: I3985e80e4b2a230f83526191ea1379765a54bdcf Signed-off-by: Erwan Mahe <erwan.mahe@intel.com> Signed-off-by: Pierre Tardy <pierre.tardy@intel.com>
* repo download: add --cherry-pick optionPierre Tardy2012-05-241-2/+7
| | | | | | | | | | | | | | | | | | default option uses git checkout, and thus overwrite the previous checkouts. this is a problem for automated builds of several changesets in the same project for daily builds of pending submission You can now use: repo download [--cherry-pick|-c] project changeid/patchnumber This will parse the manifest, cd to the corresponding project download the changes to FETCH_HEAD and cherry-pick the result. This is useful to automate cherry-picking of a patch in the context of build automation, and commit gating (e.g. buildbot) Change-Id: Ib638afd87677f1be197afb7b0f73c70fb98909fe Signed-off-by: Pierre Tardy <pierre.tardy@intel.com>
* Fix to display the usage message of the command download when the userThiago Farina2011-01-091-0/+3
| | | | | | | don't provide any arguments to 'repo download'. Signed-off-by: Thiago Farina <thiago.farina@gmail.com> (cherry picked from commit 840ed0fab7cb4c2ab296c7d7d45f13e2523bae1c)
* Teach repo how to download changes to the local checkoutv1.0.4Shawn O. Pearce2008-10-231-0/+78
Now `repo download . 1402` would download the change numbered 1402 into the current project and check it out for the user, using a detached HEAD. `repo sync .` would back out of the change and return to the upstream version. Multiple projects can be fetched at once by listing them out on the command line as different arguments. Individual patch sets can be selected by adding a '/n' to indicate the n-th patch set should be downloaded instead of the default of patch set 1. Signed-off-by: Shawn O. Pearce <sop@google.com>