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

login
register
mail settings
Submitter Durham Goode
Date March 20, 2015, 1:14 a.m.
Message ID <22e9be40a47d397339c4.1426814067@dev2000.prn2.facebook.com>
Download mbox | patch
Permalink /patch/8190/
State Accepted
Headers show

Comments

Durham Goode - March 20, 2015, 1:14 a.m.
# HG changeset patch
# User Durham Goode <durham@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.

Patch

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: