Merge pull request #3061 from jb-leger/hg_permission_error

Catch PermissionError which occur when a user doesn't have access to …
This commit is contained in:
Morten Enemark Lund 2019-04-23 14:33:37 +02:00 committed by GitHub
commit a7a0e2ee2b
Failed to generate hash of commit
2 changed files with 35 additions and 8 deletions

View file

@ -0,0 +1,24 @@
**Added:**
* <news item>
**Changed:**
* <news item>
**Deprecated:**
* <news item>
**Removed:**
* <news item>
**Fixed:**
* Fixed issue which occurs when user doesn't have access to parent directory and
xonsh scan all parents directory to find if we are in a Hg repository.
**Security:**
* <news item>

View file

@ -60,6 +60,7 @@ def _get_hg_root(q):
while True:
if not os.path.isdir(_curpwd):
return False
try:
if any([b.name == ".hg" for b in xt.scandir(_curpwd)]):
q.put(_curpwd)
break
@ -68,6 +69,8 @@ def _get_hg_root(q):
_curpwd = os.path.split(_curpwd)[0]
if _oldpwd == _curpwd:
return False
except OSError:
return False
def get_hg_branch(root=None):