Merge pull request #1941 from xonsh/vc

run git/hg only if we can locate binary
This commit is contained in:
Gil Forsyth 2016-11-09 08:52:22 -05:00 committed by GitHub
commit 97ffb28b56

View file

@ -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