diff options
Diffstat (limited to 'subcmds/download.py')
-rw-r--r-- | subcmds/download.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/subcmds/download.py b/subcmds/download.py index 12d99526..db9595a2 100644 --- a/subcmds/download.py +++ b/subcmds/download.py | |||
@@ -40,6 +40,8 @@ If no project is specified try to use current directory as a project. | |||
40 | p.add_option('-c', '--cherry-pick', | 40 | p.add_option('-c', '--cherry-pick', |
41 | dest='cherrypick', action='store_true', | 41 | dest='cherrypick', action='store_true', |
42 | help="cherry-pick instead of checkout") | 42 | help="cherry-pick instead of checkout") |
43 | p.add_option('-x', '--record-origin', action='store_true', | ||
44 | help='pass -x when cherry-picking') | ||
43 | p.add_option('-r', '--revert', | 45 | p.add_option('-r', '--revert', |
44 | dest='revert', action='store_true', | 46 | dest='revert', action='store_true', |
45 | help="revert instead of checkout") | 47 | help="revert instead of checkout") |
@@ -78,6 +80,14 @@ If no project is specified try to use current directory as a project. | |||
78 | project = self.GetProjects([a])[0] | 80 | project = self.GetProjects([a])[0] |
79 | return to_get | 81 | return to_get |
80 | 82 | ||
83 | def ValidateOptions(self, opt, args): | ||
84 | if opt.record_origin: | ||
85 | if not opt.cherrypick: | ||
86 | self.OptionParser.error('-x only makes sense with --cherry-pick') | ||
87 | |||
88 | if opt.ffonly: | ||
89 | self.OptionParser.error('-x and --ff are mutually exclusive options') | ||
90 | |||
81 | def Execute(self, opt, args): | 91 | def Execute(self, opt, args): |
82 | for project, change_id, ps_id in self._ParseChangeIds(args): | 92 | for project, change_id, ps_id in self._ParseChangeIds(args): |
83 | dl = project.DownloadPatchSet(change_id, ps_id) | 93 | dl = project.DownloadPatchSet(change_id, ps_id) |
@@ -101,7 +111,8 @@ If no project is specified try to use current directory as a project. | |||
101 | print(' %s' % (c), file=sys.stderr) | 111 | print(' %s' % (c), file=sys.stderr) |
102 | if opt.cherrypick: | 112 | if opt.cherrypick: |
103 | try: | 113 | try: |
104 | project._CherryPick(dl.commit, ffonly=opt.ffonly) | 114 | project._CherryPick(dl.commit, ffonly=opt.ffonly, |
115 | record_origin=opt.record_origin) | ||
105 | except GitError: | 116 | except GitError: |
106 | print('[%s] Could not complete the cherry-pick of %s' | 117 | print('[%s] Could not complete the cherry-pick of %s' |
107 | % (project.name, dl.commit), file=sys.stderr) | 118 | % (project.name, dl.commit), file=sys.stderr) |