File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed
Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change 4848 title
4949 commits(first: 100) {
5050 totalCount
51+ nodes {
52+ commit {
53+ messageHeadline
54+ }
55+ }
5156 }
5257 mergedAt
5358 mergeCommit {
@@ -179,9 +184,19 @@ def main():
179184 else :
180185 print (f"Merging #{ pr ['node' ]['number' ]} : { pr ['node' ]['title' ]} " )
181186
182- if any (True for node in pr ["node" ]["labels" ]["nodes" ] if node ["name" ] == "backport squash" ):
183- print (" -> was squashed" )
184- pr ["node" ]["commits" ]["totalCount" ] = 1
187+ # In case of multiple commits, check if it was squashed or rebased.
188+ # We do this by comparing commit titles. As if you rebased, they have
189+ # to be identical.
190+ if pr ["node" ]["commits" ]["totalCount" ] > 1 :
191+ for i in range (pr ["node" ]["commits" ]["totalCount" ]):
192+ commit = pr ["node" ]["commits" ]["totalCount" ] - i - 1
193+ commit_str = f'{ pr ["node" ]["mergeCommit" ]["oid" ]} ' + "" .join (["^" ] * commit )
194+
195+ res = do_command (["git" , "log" , "--pretty=format:%s" , f"{ commit_str } ^..{ commit_str } " ])
196+ if res .stdout .decode () != pr ["node" ]["commits" ]["nodes" ][i ]["commit" ]["messageHeadline" ]:
197+ print (" -> was squashed" )
198+ pr ["node" ]["commits" ]["totalCount" ] = 1
199+ break
185200
186201 for i in range (pr ["node" ]["commits" ]["totalCount" ]):
187202 if resume_i is not None :
You can’t perform that action at this time.
0 commit comments