mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 16:34:47 +01:00
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:
commit
a7a0e2ee2b
2 changed files with 35 additions and 8 deletions
24
news/hg_permission_error.rst
Normal file
24
news/hg_permission_error.rst
Normal 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>
|
|
@ -60,14 +60,17 @@ def _get_hg_root(q):
|
|||
while True:
|
||||
if not os.path.isdir(_curpwd):
|
||||
return False
|
||||
if any([b.name == ".hg" for b in xt.scandir(_curpwd)]):
|
||||
q.put(_curpwd)
|
||||
break
|
||||
else:
|
||||
_oldpwd = _curpwd
|
||||
_curpwd = os.path.split(_curpwd)[0]
|
||||
if _oldpwd == _curpwd:
|
||||
return False
|
||||
try:
|
||||
if any([b.name == ".hg" for b in xt.scandir(_curpwd)]):
|
||||
q.put(_curpwd)
|
||||
break
|
||||
else:
|
||||
_oldpwd = _curpwd
|
||||
_curpwd = os.path.split(_curpwd)[0]
|
||||
if _oldpwd == _curpwd:
|
||||
return False
|
||||
except OSError:
|
||||
return False
|
||||
|
||||
|
||||
def get_hg_branch(root=None):
|
||||
|
|
Loading…
Add table
Reference in a new issue