mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-06 09:20:57 +01:00
Merge pull request #1941 from xonsh/vc
run git/hg only if we can locate binary
This commit is contained in:
commit
97ffb28b56
1 changed files with 4 additions and 4 deletions
|
@ -140,9 +140,9 @@ def current_branch(pad=NotImplemented):
|
|||
"and will be removed in the future")
|
||||
branch = None
|
||||
cmds = builtins.__xonsh_commands_cache__
|
||||
if cmds.lazy_locate_binary('git') or cmds.is_empty():
|
||||
if cmds.lazy_locate_binary('git'):
|
||||
branch = get_git_branch()
|
||||
if (cmds.lazy_locate_binary('hg') or cmds.is_empty()) and not branch:
|
||||
if cmds.lazy_locate_binary('hg') and not branch:
|
||||
branch = get_hg_branch()
|
||||
if isinstance(branch, subprocess.TimeoutExpired):
|
||||
branch = '<branch-timeout>'
|
||||
|
@ -209,9 +209,9 @@ def dirty_working_directory():
|
|||
"""
|
||||
dwd = None
|
||||
cmds = builtins.__xonsh_commands_cache__
|
||||
if cmds.lazy_locate_binary('git') or cmds.is_empty():
|
||||
if cmds.lazy_locate_binary('git'):
|
||||
dwd = git_dirty_working_directory()
|
||||
if (cmds.lazy_locate_binary('hg') or cmds.is_empty()) and (dwd is None):
|
||||
if cmds.lazy_locate_binary('hg') and dwd is None:
|
||||
dwd = hg_dirty_working_directory()
|
||||
return dwd
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue