diff options
author | Mike Frysinger <vapier@google.com> | 2020-03-22 12:14:01 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2020-03-23 00:26:26 +0000 |
commit | ea43176de0a46eadb12be814517532a13eec8b1d (patch) | |
tree | 32adc185cc21afba8462fa662e4bc1ccc1fcd827 | |
parent | 58ac1678e8438fd029a22365741fc57276eda404 (diff) | |
download | git-repo-ea43176de0a46eadb12be814517532a13eec8b1d.tar.gz |
download: support --ff when cherry-picking
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>
-rw-r--r-- | project.py | 4 | ||||
-rw-r--r-- | subcmds/download.py | 2 |
2 files changed, 4 insertions, 2 deletions
@@ -2681,8 +2681,10 @@ class Project(object): | |||
2681 | if self._allrefs: | 2681 | if self._allrefs: |
2682 | raise GitError('%s checkout %s ' % (self.name, rev)) | 2682 | raise GitError('%s checkout %s ' % (self.name, rev)) |
2683 | 2683 | ||
2684 | def _CherryPick(self, rev): | 2684 | def _CherryPick(self, rev, ffonly=False): |
2685 | cmd = ['cherry-pick'] | 2685 | cmd = ['cherry-pick'] |
2686 | if ffonly: | ||
2687 | cmd.append('--ff') | ||
2686 | cmd.append(rev) | 2688 | cmd.append(rev) |
2687 | cmd.append('--') | 2689 | cmd.append('--') |
2688 | if GitCommand(self, cmd).Wait() != 0: | 2690 | if GitCommand(self, cmd).Wait() != 0: |
diff --git a/subcmds/download.py b/subcmds/download.py index 87d0ce04..12d99526 100644 --- a/subcmds/download.py +++ b/subcmds/download.py | |||
@@ -101,7 +101,7 @@ If no project is specified try to use current directory as a project. | |||
101 | print(' %s' % (c), file=sys.stderr) | 101 | print(' %s' % (c), file=sys.stderr) |
102 | if opt.cherrypick: | 102 | if opt.cherrypick: |
103 | try: | 103 | try: |
104 | project._CherryPick(dl.commit) | 104 | project._CherryPick(dl.commit, ffonly=opt.ffonly) |
105 | except GitError: | 105 | except GitError: |
106 | print('[%s] Could not complete the cherry-pick of %s' | 106 | print('[%s] Could not complete the cherry-pick of %s' |
107 | % (project.name, dl.commit), file=sys.stderr) | 107 | % (project.name, dl.commit), file=sys.stderr) |