@@ -379,7 +379,7 @@ def error(msg: str) -> None:
379379 print (red ("\n ERROR: " ) + msg )
380380
381381
382- def log (msg : str , * , level : int = 0 ) -> None :
382+ def log (msg : str , * , level : int = 1 ) -> None :
383383 if level <= 1 :
384384 print (msg )
385385 elif level == 1 :
@@ -455,7 +455,7 @@ def set_base_branches(st: list[StackEntry], target: str) -> None:
455455
456456
457457def verify (st : list [StackEntry ], * , check_base : bool = False ) -> None :
458- log (h ("Verifying stack info" ), level = 1 )
458+ log (h ("Verifying stack info" ))
459459 for index , e in enumerate (st ):
460460 if e .has_missing_info ():
461461 error (ERROR_STACKINFO_MISSING .format (** locals ()))
@@ -648,7 +648,7 @@ def set_head_branches(
648648def init_local_branches (
649649 st : list [StackEntry ], remote : str , * , verbose : bool , branch_name_template : str
650650) -> None :
651- log (h ("Initializing local branches" ), level = 1 )
651+ log (h ("Initializing local branches" ))
652652 set_head_branches (
653653 st , remote , verbose = verbose , branch_name_template = branch_name_template
654654 )
@@ -660,7 +660,7 @@ def init_local_branches(
660660
661661
662662def push_branches (st : list [StackEntry ], remote : str , * , verbose : bool ) -> None :
663- log (h ("Updating remote branches" ), level = 1 )
663+ log (h ("Updating remote branches" ))
664664 cmd = ["git" , "push" , "-f" , remote ]
665665 cmd .extend ([f"{ e .head } :{ e .head } " for e in st ])
666666 run_shell_command (cmd , quiet = not verbose )
@@ -950,14 +950,13 @@ def command_submit(
950950 # Determine what commits belong to the stack
951951 st = get_stack (base = args .base , head = args .head , verbose = args .verbose )
952952 if not st :
953- log (h ("Empty stack!" ), level = 1 )
954- log (h (blue ("SUCCESS!" )), level = 1 )
953+ log (h ("Empty stack!" ))
954+ log (h (blue ("SUCCESS!" )))
955955 return
956956
957957 if (draft_bitmask is not None ) and (len (draft_bitmask ) != len (st )):
958958 log (
959- h ("Draft bitmask passed to 'submit' doesn't match number of PRs!" ),
960- level = 1 ,
959+ h ("Draft bitmask passed to 'submit' doesn't match number of PRs!" )
961960 )
962961 return
963962
@@ -970,7 +969,7 @@ def command_submit(
970969 branch_name_template = args .branch_name_template ,
971970 )
972971 set_base_branches (st , args .target )
973- print_stack (st , links = args .hyperlinks , level = 1 )
972+ print_stack (st , links = args .hyperlinks )
974973
975974 # If the current branch contains commits from the stack, we will need to
976975 # rebase it in the end since the commits will be modified.
@@ -1156,7 +1155,7 @@ def command_land(args: CommonArgs) -> None:
11561155 # already be there from the metadata that commits need to have by that
11571156 # point.
11581157 set_base_branches (st , args .target )
1159- print_stack (st , links = args .hyperlinks , level = 1 )
1158+ print_stack (st , links = args .hyperlinks )
11601159
11611160 # Verify that the stack is correct before trying to land it.
11621161 verify (st , check_base = True )
@@ -1193,7 +1192,7 @@ def command_land(args: CommonArgs) -> None:
11931192 quiet = not args .verbose ,
11941193 )
11951194
1196- log (h (blue ("SUCCESS!" )), level = 1 )
1195+ log (h (blue ("SUCCESS!" )))
11971196
11981197
11991198# ===----------------------------------------------------------------------=== #
@@ -1246,11 +1245,11 @@ def strip_metadata(e: StackEntry, *, needs_rebase: bool, verbose: bool) -> str:
12461245# Entry point for 'abandon' command
12471246# ===----------------------------------------------------------------------=== #
12481247def command_abandon (args : CommonArgs ) -> None :
1249- log (h ("ABANDON" ), level = 1 )
1248+ log (h ("ABANDON" ))
12501249 st = get_stack (base = args .base , head = args .head , verbose = args .verbose )
12511250 if not st :
1252- log (h ("Empty stack!" ), level = 1 )
1253- log (h (blue ("SUCCESS!" )), level = 1 )
1251+ log (h ("Empty stack!" ))
1252+ log (h (blue ("SUCCESS!" )))
12541253 return
12551254 current_branch = get_current_branch_name ()
12561255
@@ -1261,9 +1260,9 @@ def command_abandon(args: CommonArgs) -> None:
12611260 branch_name_template = args .branch_name_template ,
12621261 )
12631262 set_base_branches (st , args .target )
1264- print_stack (st , links = args .hyperlinks , level = 1 )
1263+ print_stack (st , links = args .hyperlinks )
12651264
1266- log (h ("Stripping stack metadata from commit messages" ), level = 1 )
1265+ log (h ("Stripping stack metadata from commit messages" ))
12671266
12681267 last_hash = ""
12691268 # The first commit doesn't need to be rebased since its will not change.
@@ -1274,7 +1273,7 @@ def command_abandon(args: CommonArgs) -> None:
12741273 last_hash = strip_metadata (e , needs_rebase = need_rebase , verbose = args .verbose )
12751274 need_rebase = True
12761275
1277- log (h ("Rebasing the current branch on top of updated top branch" ), level = 1 )
1276+ log (h ("Rebasing the current branch on top of updated top branch" ))
12781277 run_shell_command (
12791278 ["git" , "rebase" , last_hash , current_branch ], quiet = not args .verbose
12801279 )
@@ -1286,7 +1285,7 @@ def command_abandon(args: CommonArgs) -> None:
12861285 verbose = args .verbose ,
12871286 branch_name_template = args .branch_name_template ,
12881287 )
1289- log (h (blue ("SUCCESS!" )), level = 1 )
1288+ log (h (blue ("SUCCESS!" )))
12901289
12911290
12921291# ===----------------------------------------------------------------------=== #
@@ -1304,24 +1303,21 @@ def print_tips_after_view(st: list[StackEntry], args: CommonArgs) -> None:
13041303 top_commit = get_current_branch_name ()
13051304
13061305 if ready_to_land :
1307- log (b ("\n This stack is ready to land!" ), level = 1 )
1306+ log (b ("\n This stack is ready to land!" ))
13081307 log (UPDATE_STACK_TIP .format (** locals ()))
13091308 log (LAND_STACK_TIP .format (** locals ()))
13101309 return
13111310
13121311 # Stack is not ready to land, suggest exporting it first
1313- log (
1314- b ("\n This stack can't be landed yet, you need to export it first." ),
1315- level = 1 ,
1316- )
1312+ log (b ("\n This stack can't be landed yet, you need to export it first." ))
13171313 log (EXPORT_STACK_TIP .format (** locals ()))
13181314
13191315
13201316# ===----------------------------------------------------------------------=== #
13211317# Entry point for 'view' command
13221318# ===----------------------------------------------------------------------=== #
13231319def command_view (args : CommonArgs ) -> None :
1324- log (h ("VIEW" ), level = 1 )
1320+ log (h ("VIEW" ))
13251321
13261322 if should_update_local_base (
13271323 head = args .head ,
@@ -1335,19 +1331,15 @@ def command_view(args: CommonArgs) -> None:
13351331 f"\n Warning: Local '{ args .base } ' is behind"
13361332 f" '{ args .remote } /{ args .target } '!"
13371333 ),
1338- level = 1 ,
13391334 )
13401335 log (
13411336 ("Consider updating your local branch by running the following commands:" ),
1342- level = 1 ,
13431337 )
13441338 log (
13451339 b (f" git rebase { args .remote } /{ args .target } { args .base } " ),
1346- level = 1 ,
13471340 )
13481341 log (
13491342 b (f" git checkout { get_current_branch_name ()} \n " ),
1350- level = 1 ,
13511343 )
13521344
13531345 st = get_stack (base = args .base , head = args .head , verbose = args .verbose )
@@ -1359,9 +1351,9 @@ def command_view(args: CommonArgs) -> None:
13591351 branch_name_template = args .branch_name_template ,
13601352 )
13611353 set_base_branches (st , target = args .target )
1362- print_stack (st , links = args .hyperlinks , level = 1 )
1354+ print_stack (st , links = args .hyperlinks )
13631355 print_tips_after_view (st , args )
1364- log (h (blue ("SUCCESS!" )), level = 1 )
1356+ log (h (blue ("SUCCESS!" )))
13651357
13661358
13671359# ===----------------------------------------------------------------------=== #
0 commit comments