@@ -134,6 +134,17 @@ def merge_source_into_target(source: str, target: str, dry_run: bool):
134134 print (err , file = sys .stderr )
135135 sys .exit (1 )
136136
137+ def do_push (branch_name : str , dry_run : bool ):
138+ print (f"Pushing branch { branch_name } " )
139+ rc , out , err = run_git (["push" ], dry_run )
140+ if rc != 0 :
141+ print (f"Failed to push branch { branch_name } " , file = sys .stderr )
142+ if out :
143+ print (out )
144+ if err :
145+ print (err )
146+ sys .exit (1 )
147+
137148def tag_and_push (branch : str , version : str , push : bool , dry_run : bool ):
138149 tag = f"{ branch } -{ version } "
139150 # check tag does not already exist
@@ -165,7 +176,7 @@ def fetch_origin(dry_run: bool):
165176 print ("Fetching origin ..." )
166177 rc , out , err = run_git (["fetch" , "origin" ], dry_run )
167178 if rc != 0 :
168- print ("Warning: 'git fetch origin --prune ' returned non-zero." , file = sys .stderr )
179+ print ("Warning: 'git fetch origin' returned non-zero." , file = sys .stderr )
169180 if out :
170181 print (out )
171182 if err :
@@ -215,12 +226,15 @@ def main():
215226 print (f"Merge of { prev } into { br } failed. Aborting." , file = sys .stderr )
216227 sys .exit (1 )
217228
229+ if push :
230+ do_push (br , dry_run = dry_run )
231+
218232 tag_and_push (br , version , push = push , dry_run = dry_run )
219233
220234 prev = br
221235
222236 print ("\n Switching back to dev branch..." )
223- run_git ([ "checkout" , " dev"], dry_run )
237+ checkout_branch ( " dev", dry_run = dry_run )
224238
225239 print ("\n All done. Created tags for version" , version , "on branches:" , ", " .join (branches ))
226240
0 commit comments