@@ -84,6 +84,10 @@ def _Options(self, p):
84
84
type = 'string' , action = 'store' , dest = 'dest_branch' ,
85
85
metavar = 'BRANCH' ,
86
86
help = 'Push on this target branch.' )
87
+ p .add_option ('-f' , '--force' ,
88
+ dest = 'force_push' ,
89
+ action = 'store_true' ,
90
+ help = 'Force push' )
87
91
88
92
# Options relating to push hook. Note that verify and no-verify are NOT
89
93
# opposites of each other, which is why they store to different locations.
@@ -252,7 +256,7 @@ def _Push(self, opt, todo):
252
256
branch .uploaded = False
253
257
continue
254
258
255
- self .Push (branch , dest_branch = destination )
259
+ self .Push (branch , dest_branch = destination , force = opt . force_push )
256
260
branch .uploaded = True
257
261
except UploadError as e :
258
262
branch .error = e
@@ -287,7 +291,7 @@ def _Push(self, opt, todo):
287
291
sys .exit (1 )
288
292
289
293
def Push (self , branch_base , branch = None ,
290
- dest_branch = None ):
294
+ dest_branch = None , force = False ):
291
295
"""Pushs the named branch.
292
296
"""
293
297
project = branch_base .project
@@ -313,6 +317,10 @@ def Push(self, branch_base, branch=None,
313
317
314
318
remote = branch .remote .name
315
319
cmd = ['push' ]
320
+
321
+ if force :
322
+ cmd .append ('--force' )
323
+
316
324
cmd .append (remote )
317
325
318
326
if dest_branch .startswith (R_HEADS ):
0 commit comments