summaryrefslogtreecommitdiffstats
path: root/subcmds/download.py
diff options
context:
space:
mode:
authorErwan Mahe <erwan.mahe@intel.com>2011-08-19 13:56:09 +0200
committerShawn O. Pearce <sop@google.com>2012-05-24 09:03:10 -0700
commita94f162b9fe85389f3e1c9555628d9229105e15d (patch)
treeda3852d6ede787a8d1974cddab3db8c98e4fc39e /subcmds/download.py
parente5a2122e6429b5eee861807e7050eb02045a7d4f (diff)
downloadgit-repo-a94f162b9fe85389f3e1c9555628d9229105e15d.tar.gz
repo download: add --revert option
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>
Diffstat (limited to 'subcmds/download.py')
-rw-r--r--subcmds/download.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/subcmds/download.py b/subcmds/download.py
index 79d0192d..f79f485b 100644
--- a/subcmds/download.py
+++ b/subcmds/download.py
@@ -36,6 +36,9 @@ makes it available in your project's local working directory.
36 p.add_option('-c','--cherry-pick', 36 p.add_option('-c','--cherry-pick',
37 dest='cherrypick', action='store_true', 37 dest='cherrypick', action='store_true',
38 help="cherry-pick instead of checkout") 38 help="cherry-pick instead of checkout")
39 p.add_option('-r','--revert',
40 dest='revert', action='store_true',
41 help="revert instead of checkout")
39 42
40 def _ParseChangeIds(self, args): 43 def _ParseChangeIds(self, args):
41 if not args: 44 if not args:
@@ -68,7 +71,7 @@ makes it available in your project's local working directory.
68 % (project.name, change_id, ps_id) 71 % (project.name, change_id, ps_id)
69 sys.exit(1) 72 sys.exit(1)
70 73
71 if not dl.commits: 74 if not opt.revert and not dl.commits:
72 print >>sys.stderr, \ 75 print >>sys.stderr, \
73 '[%s] change %d/%d has already been merged' \ 76 '[%s] change %d/%d has already been merged' \
74 % (project.name, change_id, ps_id) 77 % (project.name, change_id, ps_id)
@@ -82,5 +85,7 @@ makes it available in your project's local working directory.
82 print >>sys.stderr, ' %s' % (c) 85 print >>sys.stderr, ' %s' % (c)
83 if opt.cherrypick: 86 if opt.cherrypick:
84 project._CherryPick(dl.commit) 87 project._CherryPick(dl.commit)
88 elif opt.revert:
89 project._Revert(dl.commit)
85 else: 90 else:
86 project._Checkout(dl.commit) 91 project._Checkout(dl.commit)