commit_in_branch.py: add support for checking staging branches

Or any branch that contains a `/` slash.

Cc: mesa-stable
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19988>
This commit is contained in:
Eric Engestrom
2022-11-24 15:59:51 +00:00
committed by Marge Bot
parent 3b07d57ff9
commit 707015891f
2 changed files with 7 additions and 3 deletions

View File

@@ -62,7 +62,7 @@ def branch_has_backport_of_commit(upstream: str, branch: str, commit: str) -> st
or an empty string if is hasn't
"""
out = subprocess.check_output(['git', 'log', '--format=%H',
branch + '-branchpoint..' + upstream + '/' + branch,
upstream + '..' + upstream + '/' + branch,
'--grep', 'cherry picked from commit ' + commit],
stderr=subprocess.DEVNULL)
return out.decode().strip()
@@ -89,7 +89,7 @@ def validate_branch(branch: str) -> str:
out = subprocess.check_output(['git', 'remote', '--verbose'],
stderr=subprocess.DEVNULL)
remotes = out.decode().splitlines()
(upstream, _) = branch.split('/')
upstream, _ = branch.split('/', 1)
valid_remote = False
for line in remotes:
if line.startswith(upstream + '\t'):
@@ -125,7 +125,7 @@ if __name__ == "__main__":
help='colorize output (default: true if stdout is a terminal)')
args = parser.parse_args()
(upstream, branch) = args.branch.split('/')
upstream, branch = args.branch.split('/', 1)
if branch_has_commit(upstream, branch, args.commit):
print_(args, True, 'Commit ' + args.commit + ' is in branch ' + branch)