mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-06 17:30:59 +01:00
fix for no branch in pwd
This commit is contained in:
parent
724e8e5861
commit
752fe1f7f0
2 changed files with 22 additions and 17 deletions
|
@ -85,12 +85,17 @@ def current_branch(pad=NotImplemented):
|
||||||
branch = None
|
branch = None
|
||||||
cmds = builtins.__xonsh_commands_cache__
|
cmds = builtins.__xonsh_commands_cache__
|
||||||
if cmds.lazy_locate_binary('git') or cmds.is_empty():
|
if cmds.lazy_locate_binary('git') or cmds.is_empty():
|
||||||
branch = xonsh.prompt.gitstatus.gitstatus().branch
|
try:
|
||||||
if (cmds.lazy_locate_binary('hg') or cmds.is_empty()) and not branch:
|
status = xonsh.prompt.gitstatus.gitstatus()
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
branch = None
|
||||||
|
else:
|
||||||
|
branch = status.branch
|
||||||
|
elif (cmds.lazy_locate_binary('hg') or cmds.is_empty()) and not branch:
|
||||||
branch = get_hg_branch()
|
branch = get_hg_branch()
|
||||||
if isinstance(branch, subprocess.TimeoutExpired):
|
if isinstance(branch, subprocess.TimeoutExpired):
|
||||||
branch = '<branch-timeout>'
|
branch = '<branch-timeout>'
|
||||||
_first_branch_timeout_message()
|
# _first_branch_timeout_message()
|
||||||
return branch or None
|
return branch or None
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue