mirror of
https://abf.rosa.ru/djam/abf-console-client-src.git
synced 2025-02-24 02:12:49 +00:00
Be smarter with default branch
This commit is contained in:
parent
4c6d24bfc5
commit
f4c4ea14f7
1 changed files with 9 additions and 2 deletions
11
abf.py
11
abf.py
|
@ -567,9 +567,16 @@ def get():
|
||||||
cmd = ['git', 'clone', uri]
|
cmd = ['git', 'clone', uri]
|
||||||
if command_line.branch:
|
if command_line.branch:
|
||||||
cmd += ['-b', command_line.branch]
|
cmd += ['-b', command_line.branch]
|
||||||
elif default_branch > '' and default_branch != 'master':
|
|
||||||
cmd += ['-b', default_branch]
|
|
||||||
execute_command(cmd, print_to_stdout=True, exit_on_error=True)
|
execute_command(cmd, print_to_stdout=True, exit_on_error=True)
|
||||||
|
|
||||||
|
if (not command_line.branch) and default_branch > '' and default_branch != 'master':
|
||||||
|
os.chdir(project_name)
|
||||||
|
check_branch = Popen(["git", "checkout", default_branch], stdout=PIPE, stderr=PIPE)
|
||||||
|
(output, err) = check_branch.communicate()
|
||||||
|
branch_missing = check_branch.wait()
|
||||||
|
if branch_missing != 0:
|
||||||
|
log.info("Branch " + default_branch + " is missing, will use HEAD")
|
||||||
|
os.chdir("..")
|
||||||
|
|
||||||
projects_cfg[proj]['location'] = os.path.join(os.getcwd(), project_name)
|
projects_cfg[proj]['location'] = os.path.join(os.getcwd(), project_name)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue