[PATCH 2 of 5 evolve-ext] wrapcommand: fix wrapping extensions that aren't enabled

Durham Goode durham at fb.com
Thu Mar 19 20:14:27 CDT 2015


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1426793552 25200
#      Thu Mar 19 12:32:32 2015 -0700
# Node ID 22e9be40a47d397339c4d5a5ea7c82131d72d889
# Parent  7b7ed492d4d6437cfcfdc357842e91c3910ae834
wrapcommand: fix wrapping extensions that aren't enabled

The extension command wrapping would previously fail if the extension wasn't
enabled. Let's just eat that silently.

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -168,9 +168,12 @@ class exthelper(object):
             templatekw.keywords[name] = kw
         for ext, command, wrapper, opts in self._extcommandwrappers:
             if ext not in knownexts:
-                e = extensions.find(ext)
-                if e is None:
-                    raise util.Abort('extension %s not found' % ext)
+                try:
+                    e = extensions.find(ext)
+                except KeyError:
+                    # Extension isn't enabled, so don't bother trying to wrap
+                    # it.
+                    continue
                 knownexts[ext] = e.cmdtable
             entry = extensions.wrapcommand(knownexts[ext], command, wrapper)
             if opts:


More information about the Mercurial-devel mailing list