@@ -810,7 +810,12 @@ class RemoteConflictError(Exception):
810810def somewhat_safe_force_push (branch : str ) -> None :
811811 if has_non_stubsabot_commits (branch ):
812812 raise RemoteConflictError (f"origin/{ branch } has non-stubsabot changes that are not on { branch } !" )
813- subprocess .check_call (["git" , "push" , "origin" , branch , "--force" ])
813+ result = subprocess .run (["git" , "push" , "--quiet" , "origin" , branch , "--force" ], text = True , capture_output = True , check = False )
814+ if result .returncode :
815+ # Capture both streams to suppress stderr on success without losing it on failure
816+ sys .stdout .write (result .stdout )
817+ sys .stderr .write (result .stderr )
818+ result .check_returncode ()
814819
815820
816821def normalize (name : str ) -> str :
@@ -872,10 +877,10 @@ async def suggest_typeshed_update(update: Update, session: aiohttp.ClientSession
872877 title = f"[stubsabot] Bump { update .distribution } to { update .new_version } "
873878 async with _repo_lock :
874879 branch_name = f"{ BRANCH_PREFIX } /{ normalize (update .distribution )} "
875- subprocess .check_call (["git" , "checkout" , "-B" , branch_name , "origin/main" ])
880+ subprocess .check_call (["git" , "checkout" , "--quiet" , "- B" , branch_name , "origin/main" ])
876881 meta = update_metadata (update .distribution , version = update .new_version )
877882 body = get_update_pr_body (update , meta )
878- subprocess .check_call (["git" , "commit" , "--all" , "-m" , f"{ title } \n \n { body } " ])
883+ subprocess .check_call (["git" , "commit" , "--quiet" , "-- all" , "-m" , f"{ title } \n \n { body } " ])
879884 if action_level <= ActionLevel .local :
880885 return
881886 if not latest_commit_is_different_to_last_commit_on_origin (branch_name ):
@@ -894,12 +899,12 @@ async def suggest_typeshed_obsolete(obsolete: Obsolete, session: aiohttp.ClientS
894899 title = f"[stubsabot] Mark { obsolete .distribution } as obsolete since { obsolete .obsolete_since_version } "
895900 async with _repo_lock :
896901 branch_name = f"{ BRANCH_PREFIX } /{ normalize (obsolete .distribution )} "
897- subprocess .check_call (["git" , "checkout" , "-B" , branch_name , "origin/main" ])
902+ subprocess .check_call (["git" , "checkout" , "--quiet" , "- B" , branch_name , "origin/main" ])
898903 obsolete_t = cast (dict [str , object ], tomlkit .inline_table ())
899904 obsolete_t .update ({"version" : obsolete .obsolete_since_version , "date" : obsolete .obsolete_since_date .date ().isoformat ()})
900905 update_metadata (obsolete .distribution , obsolete_since = obsolete_t )
901906 body = "\n " .join (f"{ k } : { v } " for k , v in obsolete .links .items ())
902- subprocess .check_call (["git" , "commit" , "--all" , "-m" , f"{ title } \n \n { body } " ])
907+ subprocess .check_call (["git" , "commit" , "--quiet" , "-- all" , "-m" , f"{ title } \n \n { body } " ])
903908 if action_level <= ActionLevel .local :
904909 return
905910 if not latest_commit_is_different_to_last_commit_on_origin (branch_name ):
@@ -918,10 +923,10 @@ async def suggest_typeshed_remove(remove: Remove, session: aiohttp.ClientSession
918923 title = f"[stubsabot] Remove { remove .distribution } as { remove .reason } "
919924 async with _repo_lock :
920925 branch_name = f"{ BRANCH_PREFIX } /{ normalize (remove .distribution )} "
921- subprocess .check_call (["git" , "checkout" , "-B" , branch_name , "origin/main" ])
926+ subprocess .check_call (["git" , "checkout" , "--quiet" , "- B" , branch_name , "origin/main" ])
922927 remove_stubs (remove .distribution )
923928 body = "\n " .join (f"{ k } : { v } " for k , v in remove .links .items ())
924- subprocess .check_call (["git" , "commit" , "--all" , "-m" , f"{ title } \n \n { body } " ])
929+ subprocess .check_call (["git" , "commit" , "--quiet" , "-- all" , "-m" , f"{ title } \n \n { body } " ])
925930 if action_level <= ActionLevel .local :
926931 return
927932 if not latest_commit_is_different_to_last_commit_on_origin (branch_name ):
@@ -996,8 +1001,7 @@ async def main() -> int:
9961001 action_count = 0
9971002 for task in asyncio .as_completed (tasks ):
9981003 update = await task
999- print (f"{ update .distribution } ... " , end = "" )
1000- print (update )
1004+ print (f"{ update .distribution } ... { update } " , flush = True )
10011005
10021006 if isinstance (update , NoUpdate ):
10031007 continue
@@ -1029,7 +1033,7 @@ async def main() -> int:
10291033 # if you need to cleanup, try:
10301034 # git branch -D $(git branch --list 'stubsabot/*')
10311035 if args .action_level >= ActionLevel .local and original_branch :
1032- subprocess .check_call (["git" , "checkout" , original_branch ])
1036+ subprocess .check_call (["git" , "checkout" , "--quiet" , original_branch ])
10331037
10341038 return 1 if error else 0
10351039
0 commit comments