[Updated] D11820: extensions: refactor handling of loading error make it reusable

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Tue Nov 30 15:12:24 UTC 2021


Closed by commit rHGe4e2ce328599: extensions: refactor handling of loading error make it reusable (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11820?vs=31191&id=31207

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D11820/new/

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

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
@@ -307,15 +307,12 @@
             except Exception as inst:
                 msg = stringutil.forcebytestr(inst)
                 if path:
-                    ui.warn(
-                        _(b"*** failed to import extension %s from %s: %s\n")
-                        % (name, path, msg)
-                    )
+                    error_msg = _(b"failed to import extension %s from %s: %s")
+                    error_msg %= (name, path, msg)
                 else:
-                    ui.warn(
-                        _(b"*** failed to import extension %s: %s\n")
-                        % (name, msg)
-                    )
+                    error_msg = _(b"failed to import extension %s: %s")
+                    error_msg %= (name, msg)
+                ui.warn((b"*** %s\n") % error_msg)
                 if isinstance(inst, error.Hint) and inst.hint:
                     ui.warn(_(b"*** (%s)\n") % inst.hint)
                 ui.traceback()



To: marmoute, #hg-reviewers, Alphare
Cc: mharbison72, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20211130/2cf1edf5/attachment-0002.html>


More information about the Mercurial-patches mailing list