@@ -871,8 +871,9 @@ def merge_ghstack_into(
871871 skip_mandatory_checks : bool ,
872872 comment_id : Optional [int ] = None ,
873873 land_check_commit : Optional [str ] = None
874- ) -> None :
874+ ) -> List [ "GitHubPR" ] :
875875 assert self .is_ghstack_pr ()
876+ additional_prs : List ["GitHubPR" ] = []
876877 # For ghstack, cherry-pick commits based from origin
877878 orig_ref = f"{ repo .remote } /{ re .sub (r'/head$' , '/orig' , self .head_ref ())} "
878879 rev_list = repo .revlist (f"{ self .default_branch ()} ..{ orig_ref } " )
@@ -898,9 +899,11 @@ def merge_ghstack_into(
898899 skip_mandatory_checks = skip_mandatory_checks ,
899900 skip_internal_checks = can_skip_internal_checks (self , comment_id ),
900901 land_check_commit = land_check_commit )
902+ additional_prs .append (pr )
901903
902904 repo .cherry_pick (rev )
903905 repo .amend_commit_message (commit_msg )
906+ return additional_prs
904907
905908 def gen_commit_message (self , filter_ghstack : bool = False ) -> str :
906909 """ Fetches title and body from PR description
@@ -930,20 +933,22 @@ def merge_into(self, repo: GitRepo, *,
930933 skip_mandatory_checks = skip_mandatory_checks ,
931934 skip_internal_checks = can_skip_internal_checks (self , comment_id ),
932935 land_check_commit = land_check_commit )
933- self .merge_changes (repo , skip_mandatory_checks , comment_id , land_check_commit = land_check_commit )
936+ additional_merged_prs = self .merge_changes (repo , skip_mandatory_checks , comment_id , land_check_commit = land_check_commit )
934937
935938 repo .push (self .default_branch (), dry_run )
936939 if not dry_run :
937940 if land_check_commit :
938941 self .delete_land_time_check_branch (repo )
939942 gh_add_labels (self .org , self .project , self .pr_num , ["merged" ])
943+ for pr in additional_merged_prs :
944+ gh_add_labels (self .org , self .project , pr .pr_num , ["merged" ])
940945
941946 def merge_changes (self ,
942947 repo : GitRepo ,
943948 skip_mandatory_checks : bool = False ,
944949 comment_id : Optional [int ] = None ,
945950 land_check_commit : Optional [str ] = None ,
946- branch : Optional [str ] = None ) -> None :
951+ branch : Optional [str ] = None ) -> List [ "GitHubPR" ] :
947952 branch_to_merge_into = self .default_branch () if branch is None else branch
948953 if repo .current_branch () != branch_to_merge_into :
949954 repo .checkout (branch_to_merge_into )
@@ -953,8 +958,9 @@ def merge_changes(self,
953958 repo .fetch (f"pull/{ self .pr_num } /head" , pr_branch_name )
954959 repo ._run_git ("merge" , "--squash" , pr_branch_name )
955960 repo ._run_git ("commit" , f"--author=\" { self .get_author ()} \" " , "-m" , msg )
961+ return []
956962 else :
957- self .merge_ghstack_into (
963+ return self .merge_ghstack_into (
958964 repo ,
959965 skip_mandatory_checks ,
960966 comment_id = comment_id ,
0 commit comments