summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--project.py9
-rw-r--r--subcmds/download.py7
2 files changed, 15 insertions, 1 deletions
diff --git a/project.py b/project.py
index 49da34a8..1b0769a6 100644
--- a/project.py
+++ b/project.py
@@ -1645,6 +1645,15 @@ class Project(object):
1645 if self._allrefs: 1645 if self._allrefs:
1646 raise GitError('%s cherry-pick %s ' % (self.name, rev)) 1646 raise GitError('%s cherry-pick %s ' % (self.name, rev))
1647 1647
1648 def _Revert(self, rev, quiet=False):
1649 cmd = ['revert']
1650 cmd.append('--no-edit')
1651 cmd.append(rev)
1652 cmd.append('--')
1653 if GitCommand(self, cmd).Wait() != 0:
1654 if self._allrefs:
1655 raise GitError('%s revert %s ' % (self.name, rev))
1656
1648 def _ResetHard(self, rev, quiet=True): 1657 def _ResetHard(self, rev, quiet=True):
1649 cmd = ['reset', '--hard'] 1658 cmd = ['reset', '--hard']
1650 if quiet: 1659 if quiet:
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)