diff options
-rw-r--r-- | project.py | 8 | ||||
-rw-r--r-- | subcmds/download.py | 9 |
2 files changed, 15 insertions, 2 deletions
@@ -1637,6 +1637,14 @@ class Project(object): | |||
1637 | if self._allrefs: | 1637 | if self._allrefs: |
1638 | raise GitError('%s checkout %s ' % (self.name, rev)) | 1638 | raise GitError('%s checkout %s ' % (self.name, rev)) |
1639 | 1639 | ||
1640 | def _CherryPick(self, rev, quiet=False): | ||
1641 | cmd = ['cherry-pick'] | ||
1642 | cmd.append(rev) | ||
1643 | cmd.append('--') | ||
1644 | if GitCommand(self, cmd).Wait() != 0: | ||
1645 | if self._allrefs: | ||
1646 | raise GitError('%s cherry-pick %s ' % (self.name, rev)) | ||
1647 | |||
1640 | def _ResetHard(self, rev, quiet=True): | 1648 | def _ResetHard(self, rev, quiet=True): |
1641 | cmd = ['reset', '--hard'] | 1649 | cmd = ['reset', '--hard'] |
1642 | if quiet: | 1650 | if quiet: |
diff --git a/subcmds/download.py b/subcmds/download.py index 61eadd54..79d0192d 100644 --- a/subcmds/download.py +++ b/subcmds/download.py | |||
@@ -33,7 +33,9 @@ makes it available in your project's local working directory. | |||
33 | """ | 33 | """ |
34 | 34 | ||
35 | def _Options(self, p): | 35 | def _Options(self, p): |
36 | pass | 36 | p.add_option('-c','--cherry-pick', |
37 | dest='cherrypick', action='store_true', | ||
38 | help="cherry-pick instead of checkout") | ||
37 | 39 | ||
38 | def _ParseChangeIds(self, args): | 40 | def _ParseChangeIds(self, args): |
39 | if not args: | 41 | if not args: |
@@ -78,4 +80,7 @@ makes it available in your project's local working directory. | |||
78 | % (project.name, change_id, ps_id, len(dl.commits)) | 80 | % (project.name, change_id, ps_id, len(dl.commits)) |
79 | for c in dl.commits: | 81 | for c in dl.commits: |
80 | print >>sys.stderr, ' %s' % (c) | 82 | print >>sys.stderr, ' %s' % (c) |
81 | project._Checkout(dl.commit) | 83 | if opt.cherrypick: |
84 | project._CherryPick(dl.commit) | ||
85 | else: | ||
86 | project._Checkout(dl.commit) | ||