increased speed of hg segment by checking for .hg-dir first

This commit is contained in:
Michael Suelmann 2018-03-09 17:13:43 +01:00
parent 25bb4db5bd
commit 922cedbf54

View file

@ -44,6 +44,15 @@ def _get_hg_status(output):
def build_stats():
# check if we are in a hg dir
path = '/'
for p in os.getenv("PWD").split('/'):
path += p + '/'
if os.path.isdir(path+'.hg'):
break
else:
return None, None
try:
p = subprocess.Popen(["hg", "status"],
stdout=subprocess.PIPE,