mirror of
https://github.com/truenas/scale-build.git
synced 2025-12-24 04:50:48 +00:00
Check if branch exists locally or upstream before branching out
This commit is contained in:
@@ -30,6 +30,10 @@ def branch_exists_in_repository(origin, branch):
|
||||
return bool(re.findall(fr'/{branch}\n', cp.stdout, re.M))
|
||||
|
||||
|
||||
def branch_checked_out_locally(path, branch):
|
||||
return bool(run(['git', '-C', path, '--list', branch], log=False).stdout.strip())
|
||||
|
||||
|
||||
def create_branch(path, base_branch, new_branch):
|
||||
run(['git', '-C', path, 'checkout', '-b', new_branch, base_branch])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user