Patchwork D1164: extensions: always include traceback when extension setup fails

login
register
mail settings
Submitter phabricator
Date Oct. 18, 2017, 12:47 p.m.
Message ID <ee86eed4a3f18164cd52bd07d8d95d56@localhost.localdomain>
Download mbox | patch
Permalink /patch/25162/
State Not Applicable
Headers show

Comments

phabricator - Oct. 18, 2017, 12:47 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG78d9a7b7cdb6: extensions: always include traceback when extension setup fails (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1164?vs=2939&id=2974

REVISION DETAIL
  https://phab.mercurial-scm.org/D1164

AFFECTED FILES
  mercurial/extensions.py
  tests/test-extension.t
  tests/test-flagprocessor.t

CHANGE DETAILS




To: martinvonz, #hg-reviewers, quark
Cc: mercurial-devel

Patch

diff --git a/tests/test-flagprocessor.t b/tests/test-flagprocessor.t
--- a/tests/test-flagprocessor.t
+++ b/tests/test-flagprocessor.t
@@ -162,8 +162,18 @@ 
   > duplicate=$TESTDIR/flagprocessorext.py
   > EOF
   $ hg debugrebuilddirstate
+  Traceback (most recent call last):
+    File "*/mercurial/extensions.py", line *, in _runextsetup (glob)
+      extsetup(ui)
+    File "*/tests/flagprocessorext.py", line *, in extsetup (glob)
+      validatehash,
+    File "*/mercurial/revlog.py", line *, in addflagprocessor (glob)
+      raise error.Abort(msg)
+  Abort: cannot register multiple processors on flag '0x8'.
   *** failed to set up extension duplicate: cannot register multiple processors on flag '0x8'.
   $ hg st 2>&1 | egrep 'cannot register multiple processors|flagprocessorext'
+    File "*/tests/flagprocessorext.py", line *, in extsetup (glob)
+  Abort: cannot register multiple processors on flag '0x8'.
   *** failed to set up extension duplicate: cannot register multiple processors on flag '0x8'.
     File "*/tests/flagprocessorext.py", line *, in b64decode (glob)
 
diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -524,15 +524,6 @@ 
 
 Even though the extension fails during uisetup, hg is still basically usable:
   $ hg --config extensions.baduisetup=$TESTTMP/baduisetup.py version
-  *** failed to set up extension baduisetup: integer division or modulo by zero
-  Mercurial Distributed SCM (version *) (glob)
-  (see https://mercurial-scm.org for more information)
-  
-  Copyright (C) 2005-2017 Matt Mackall and others
-  This is free software; see the source for copying conditions. There is NO
-  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-  $ hg --config extensions.baduisetup=$TESTTMP/baduisetup.py version --traceback
   Traceback (most recent call last):
     File "*/mercurial/extensions.py", line *, in _runuisetup (glob)
       uisetup(ui)
diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -182,7 +182,7 @@ 
         try:
             uisetup(ui)
         except Exception as inst:
-            ui.traceback()
+            ui.traceback(force=True)
             msg = util.forcebytestr(inst)
             ui.warn(_("*** failed to set up extension %s: %s\n") % (name, msg))
             return False
@@ -203,7 +203,7 @@ 
                     raise
                 extsetup() # old extsetup with no ui argument
         except Exception as inst:
-            ui.traceback()
+            ui.traceback(force=True)
             msg = util.forcebytestr(inst)
             ui.warn(_("*** failed to set up extension %s: %s\n") % (name, msg))
             return False