directaccess: don't crash when evolve is not loaded
authorLaurent Charignon <lcharignon@fb.com>
Fri, 22 May 2015 10:38:16 -0700
changeset 1347 b00c2fe51ac8
parent 1346 9a1415f8b21b
child 1348 14b537042245
directaccess: don't crash when evolve is not loaded Before this patch, when evolve was not loaded direct access was crashing. This patch catches the error and prevents the crash.
hgext/directaccess.py
--- a/hgext/directaccess.py	Wed May 20 10:58:32 2015 -0700
+++ b/hgext/directaccess.py	Fri May 22 10:38:16 2015 -0700
@@ -47,11 +47,11 @@
     branchmap.subsettable['visible-directaccess-warn'] = 'visible'
 
     for warn, ext, cmd in directaccesslevel:
-        cmdtable = extensions.find(ext).cmdtable if ext else commands.table
-        wrapper = wrapwithwarning if warn else wrapwithoutwarning
         try:
+            cmdtable = extensions.find(ext).cmdtable if ext else commands.table
+            wrapper = wrapwithwarning if warn else wrapwithoutwarning
             extensions.wrapcommand(cmdtable, cmd, wrapper)
-        except error.UnknownCommand:
+        except (error.UnknownCommand, KeyError):
             pass
 
 def wrapwithoutwarning(orig, ui, repo, *args, **kwargs):