Skip to content
Snippets Groups Projects
Commit 06385a2b authored by timeless developer's avatar timeless developer
Browse files

init: handle AttributeError in addition to ImportError

If a module doesn't exist, it yields an ImportError,
if an attribtue doesn't exist on a module, it yields an AttributeError
parent e7316a10
No related branches found
No related tags found
No related merge requests found
......@@ -50,7 +50,7 @@
try:
from mercurial import exchange
exchange.push # existed in first iteration of this file
except ImportError:
except (AttributeError, ImportError):
# We only *use* the exchange module in hg 3.2+, so this is safe
pass
......@@ -58,7 +58,7 @@
from mercurial import ignore
ignore.readpats
ignoremod = True
except ImportError:
except (AttributeError, ImportError):
# The ignore module disappeared in Mercurial 3.5
ignoremod = False
......
......@@ -1525,7 +1525,7 @@
from mercurial import encoding
old = encoding.encoding
encoding.encoding = new_encoding
except ImportError:
except (AttributeError, ImportError):
old = hgutil._encoding
hgutil._encoding = new_encoding
return old
......
......@@ -8,7 +8,7 @@
from mercurial import ignore
ignore.readpats
ignoremod = True
except ImportError:
except (AttributeError, ImportError):
# ignore module was removed in Mercurial 3.5
ignoremod = False
from mercurial import match as matchmod
......@@ -18,7 +18,7 @@
try:
from mercurial import pathutil
pathutil.pathauditor
except ImportError:
except (AttributeError, ImportError):
pathutil = scmutil
from mercurial import util
from mercurial.i18n import _
......
......@@ -240,7 +240,7 @@
try:
from mercurial import phases
return phases.draft
except ImportError:
except (AttributeError, ImportError):
return 1
def totuple(self):
......@@ -346,7 +346,7 @@
# Mercurial >= 3.3
from mercurial import namespaces
self.names = namespaces.namespaces()
except ImportError:
except (AttributeError, ImportError):
pass
def __getitem__(self, n):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment