Commit 8b3ee8e2 by Ovchar Stanislav Committed by Matthias Putz

Extension: added force option to push command, thanks to headcrabmeat

parent 1257d230
...@@ -84,6 +84,10 @@ in all projects listed in the manifest. ...@@ -84,6 +84,10 @@ in all projects listed in the manifest.
type='string', action='store', dest='dest_branch', type='string', action='store', dest='dest_branch',
metavar='BRANCH', metavar='BRANCH',
help='Push on this target branch.') help='Push on this target branch.')
p.add_option('-f', '--force',
dest='force_push',
action='store_true',
help='Force push')
# Options relating to push hook. Note that verify and no-verify are NOT # Options relating to push hook. Note that verify and no-verify are NOT
# opposites of each other, which is why they store to different locations. # opposites of each other, which is why they store to different locations.
...@@ -252,7 +256,7 @@ in all projects listed in the manifest. ...@@ -252,7 +256,7 @@ in all projects listed in the manifest.
branch.uploaded = False branch.uploaded = False
continue continue
self.Push(branch, dest_branch=destination) self.Push(branch, dest_branch=destination, force=opt.force_push)
branch.uploaded = True branch.uploaded = True
except UploadError as e: except UploadError as e:
branch.error = e branch.error = e
...@@ -287,7 +291,7 @@ in all projects listed in the manifest. ...@@ -287,7 +291,7 @@ in all projects listed in the manifest.
sys.exit(1) sys.exit(1)
def Push(self, branch_base, branch=None, def Push(self, branch_base, branch=None,
dest_branch=None): dest_branch=None, force=False):
"""Pushs the named branch. """Pushs the named branch.
""" """
project = branch_base.project project = branch_base.project
...@@ -313,6 +317,10 @@ in all projects listed in the manifest. ...@@ -313,6 +317,10 @@ in all projects listed in the manifest.
remote = branch.remote.name remote = branch.remote.name
cmd = ['push'] cmd = ['push']
if force:
cmd.append('--force')
cmd.append(remote) cmd.append(remote)
if dest_branch.startswith(R_HEADS): if dest_branch.startswith(R_HEADS):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment