[Updated] D8750: extensions: make `hg nonexistent` not crash with PyOxidizer
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Wed Jul 15 16:12:08 UTC 2020
Closed by commit rHG5d09a120b4be: extensions: make `hg nonexistent` not crash with PyOxidizer (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D8750?vs=21902&id=21906
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D8750/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D8750
AFFECTED FILES
mercurial/extensions.py
CHANGE DETAILS
diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -706,12 +706,17 @@
'''find paths of disabled extensions. returns a dict of {name: path}'''
import hgext
- extpath = os.path.dirname(
- os.path.abspath(pycompat.fsencode(hgext.__file__))
- )
- try: # might not be a filesystem path
- files = os.listdir(extpath)
- except OSError:
+ # The hgext might not have a __file__ attribute (e.g. in PyOxidizer) and
+ # it might not be on a filesystem even if it does.
+ if util.safehasattr(hgext, '__file__'):
+ extpath = os.path.dirname(
+ os.path.abspath(pycompat.fsencode(hgext.__file__))
+ )
+ try:
+ files = os.listdir(extpath)
+ except OSError:
+ return {}
+ else:
return {}
exts = {}
To: martinvonz, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200715/df8d6ffb/attachment-0002.html>
More information about the Mercurial-patches
mailing list