diff hgext/directaccess.py @ 1347:b00c2fe51ac8

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.
author Laurent Charignon <lcharignon@fb.com>
date Fri, 22 May 2015 10:38:16 -0700
parents 0e2eb196923a
children 5c13945b32fc
line wrap: on
line diff
--- 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):