Show More
@@ -167,17 +167,31 b' def load(ui, name, path):' | |||
|
167 | 167 | def _runuisetup(name, ui): |
|
168 | 168 | uisetup = getattr(_extensions[name], 'uisetup', None) |
|
169 | 169 | if uisetup: |
|
170 | try: | |
|
170 | 171 | uisetup(ui) |
|
172 | except Exception as inst: | |
|
173 | ui.traceback() | |
|
174 | msg = _forbytes(inst) | |
|
175 | ui.warn(_("*** failed to set up extension %s: %s\n") % (name, msg)) | |
|
176 | return False | |
|
177 | return True | |
|
171 | 178 | |
|
172 | 179 | def _runextsetup(name, ui): |
|
173 | 180 | extsetup = getattr(_extensions[name], 'extsetup', None) |
|
174 | 181 | if extsetup: |
|
175 | 182 | try: |
|
183 | try: | |
|
176 | 184 | extsetup(ui) |
|
177 | 185 | except TypeError: |
|
178 | 186 | if inspect.getargspec(extsetup).args: |
|
179 | 187 | raise |
|
180 | 188 | extsetup() # old extsetup with no ui argument |
|
189 | except Exception as inst: | |
|
190 | ui.traceback() | |
|
191 | msg = _forbytes(inst) | |
|
192 | ui.warn(_("*** failed to set up extension %s: %s\n") % (name, msg)) | |
|
193 | return False | |
|
194 | return True | |
|
181 | 195 | |
|
182 | 196 | def loadall(ui, whitelist=None): |
|
183 | 197 | result = ui.configitems("extensions") |
@@ -203,11 +217,19 b' def loadall(ui, whitelist=None):' | |||
|
203 | 217 | ui.warn(_("*** (%s)\n") % inst.hint) |
|
204 | 218 | ui.traceback() |
|
205 | 219 | |
|
220 | broken = set() | |
|
206 | 221 | for name in _order[newindex:]: |
|
207 | _runuisetup(name, ui) | |
|
222 | if not _runuisetup(name, ui): | |
|
223 | broken.add(name) | |
|
208 | 224 | |
|
209 | 225 | for name in _order[newindex:]: |
|
210 | _runextsetup(name, ui) | |
|
226 | if name in broken: | |
|
227 | continue | |
|
228 | if not _runextsetup(name, ui): | |
|
229 | broken.add(name) | |
|
230 | ||
|
231 | for name in broken: | |
|
232 | _extensions[name] = None | |
|
211 | 233 | |
|
212 | 234 | # Call aftercallbacks that were never met. |
|
213 | 235 | for shortname in _aftercallbacks: |
@@ -1625,9 +1625,35 b" Make sure a broken uisetup doesn't globa" | |||
|
1625 | 1625 | > baduisetup = $PWD/baduisetup.py |
|
1626 | 1626 | > EOF |
|
1627 | 1627 | |
|
1628 | Broken: an extension that triggers the import of bdiff during uisetup | |
|
1629 | can't be easily debugged: | |
|
1628 | Even though the extension fails during uisetup, hg is still basically usable: | |
|
1630 | 1629 | $ hg version |
|
1631 | abort: No module named bdiff! | |
|
1632 | (did you forget to compile extensions?) | |
|
1633 | [255] | |
|
1630 | *** failed to set up extension baduisetup: No module named bdiff | |
|
1631 | Mercurial Distributed SCM (version *) (glob) | |
|
1632 | (see https://mercurial-scm.org for more information) | |
|
1633 | ||
|
1634 | Copyright (C) 2005-2017 Matt Mackall and others | |
|
1635 | This is free software; see the source for copying conditions. There is NO | |
|
1636 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
|
1637 | ||
|
1638 | $ hg version --traceback | |
|
1639 | Traceback (most recent call last): | |
|
1640 | File "*/mercurial/extensions.py", line *, in _runuisetup (glob) | |
|
1641 | uisetup(ui) | |
|
1642 | File "$TESTTMP/baduisetup.py", line 10, in uisetup | |
|
1643 | extensions.wrapfunction(bdiff, 'blocks', blockswrapper) | |
|
1644 | File "*/mercurial/extensions.py", line *, in wrapfunction (glob) | |
|
1645 | origfn = getattr(container, funcname) | |
|
1646 | File "*/hgdemandimport/demandimportpy2.py", line *, in __getattr__ (glob) | |
|
1647 | self._load() | |
|
1648 | File "*/hgdemandimport/demandimportpy2.py", line *, in _load (glob) | |
|
1649 | mod = _hgextimport(_import, head, globals, locals, None, level) | |
|
1650 | File "*/hgdemandimport/demandimportpy2.py", line *, in _hgextimport (glob) | |
|
1651 | return importfunc(name, globals, *args, **kwargs) | |
|
1652 | ImportError: No module named bdiff | |
|
1653 | *** failed to set up extension baduisetup: No module named bdiff | |
|
1654 | Mercurial Distributed SCM (version *) (glob) | |
|
1655 | (see https://mercurial-scm.org for more information) | |
|
1656 | ||
|
1657 | Copyright (C) 2005-2017 Matt Mackall and others | |
|
1658 | This is free software; see the source for copying conditions. There is NO | |
|
1659 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
@@ -161,7 +161,8 b'' | |||
|
161 | 161 | > EOF |
|
162 | 162 | $ echo 'this should fail' > file |
|
163 | 163 | $ hg commit -Aqm 'add file' |
|
164 |
|
|
|
164 | *** failed to set up extension duplicate: cannot register multiple processors on flag '0x8'. | |
|
165 | abort: missing processor for flag '0x1'! | |
|
165 | 166 | [255] |
|
166 | 167 | |
|
167 | 168 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now