mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
repo download: add --ff-only option
Allows to ff-only a gerrit patch This patch is necessary to automatically ensure that the patch will be correctly submitted on ff-only gerrit projects You can now use: repo download (--ff-only|-f) project changeid/patchnumber This is useful to automate verification of fast forward status of a patch in the context of build automation, and commit gating (e.g. buildbot) Change-Id: I403a667557a105411a633e62c8eec23d93724b43 Signed-off-by: Erwan Mahe <erwan.mahe@intel.com> Signed-off-by: Pierre Tardy <pierre.tardy@intel.com>
This commit is contained in:
parent
a94f162b9f
commit
3d125940f6
@ -1670,8 +1670,10 @@ class Project(object):
|
|||||||
if GitCommand(self, cmd).Wait() != 0:
|
if GitCommand(self, cmd).Wait() != 0:
|
||||||
raise GitError('%s rebase %s ' % (self.name, upstream))
|
raise GitError('%s rebase %s ' % (self.name, upstream))
|
||||||
|
|
||||||
def _FastForward(self, head):
|
def _FastForward(self, head, ffonly=False):
|
||||||
cmd = ['merge', head]
|
cmd = ['merge', head]
|
||||||
|
if ffonly:
|
||||||
|
cmd.append("--ff-only")
|
||||||
if GitCommand(self, cmd).Wait() != 0:
|
if GitCommand(self, cmd).Wait() != 0:
|
||||||
raise GitError('%s merge %s ' % (self.name, head))
|
raise GitError('%s merge %s ' % (self.name, head))
|
||||||
|
|
||||||
|
@ -39,6 +39,9 @@ makes it available in your project's local working directory.
|
|||||||
p.add_option('-r','--revert',
|
p.add_option('-r','--revert',
|
||||||
dest='revert', action='store_true',
|
dest='revert', action='store_true',
|
||||||
help="revert instead of checkout")
|
help="revert instead of checkout")
|
||||||
|
p.add_option('-f','--ff-only',
|
||||||
|
dest='ffonly', action='store_true',
|
||||||
|
help="force fast-forward merge")
|
||||||
|
|
||||||
def _ParseChangeIds(self, args):
|
def _ParseChangeIds(self, args):
|
||||||
if not args:
|
if not args:
|
||||||
@ -87,5 +90,7 @@ makes it available in your project's local working directory.
|
|||||||
project._CherryPick(dl.commit)
|
project._CherryPick(dl.commit)
|
||||||
elif opt.revert:
|
elif opt.revert:
|
||||||
project._Revert(dl.commit)
|
project._Revert(dl.commit)
|
||||||
|
elif opt.ffonly:
|
||||||
|
project._FastForward(dl.commit, ffonly=True)
|
||||||
else:
|
else:
|
||||||
project._Checkout(dl.commit)
|
project._Checkout(dl.commit)
|
||||||
|
Loading…
Reference in New Issue
Block a user