##// END OF EJS Templates
extensions: extract closure that looks for commands from disabled module...
Yuya Nishihara -
r37995:b45f4c15 default
parent child Browse files
Show More
@@ -655,15 +655,7 b' def disabledext(name):'
655 if name in paths:
655 if name in paths:
656 return _disabledhelp(paths[name])
656 return _disabledhelp(paths[name])
657
657
658 def disabledcmd(ui, cmd, strict=False):
658 def _finddisabledcmd(ui, cmd, name, path, strict):
659 '''import disabled extensions until cmd is found.
660 returns (cmdname, extname, module)'''
661
662 paths = _disabledpaths(strip_init=True)
663 if not paths:
664 raise error.UnknownCommand(cmd)
665
666 def findcmd(cmd, name, path):
667 try:
659 try:
668 mod = loadpath(path, 'hgext.%s' % name)
660 mod = loadpath(path, 'hgext.%s' % name)
669 except Exception:
661 except Exception:
@@ -685,15 +677,23 b' def disabledcmd(ui, cmd, strict=False):'
685 cmd = aliases[0]
677 cmd = aliases[0]
686 return (cmd, name, mod)
678 return (cmd, name, mod)
687
679
680 def disabledcmd(ui, cmd, strict=False):
681 '''import disabled extensions until cmd is found.
682 returns (cmdname, extname, module)'''
683
684 paths = _disabledpaths(strip_init=True)
685 if not paths:
686 raise error.UnknownCommand(cmd)
687
688 ext = None
688 ext = None
689 # first, search for an extension with the same name as the command
689 # first, search for an extension with the same name as the command
690 path = paths.pop(cmd, None)
690 path = paths.pop(cmd, None)
691 if path:
691 if path:
692 ext = findcmd(cmd, cmd, path)
692 ext = _finddisabledcmd(ui, cmd, cmd, path, strict=strict)
693 if not ext:
693 if not ext:
694 # otherwise, interrogate each extension until there's a match
694 # otherwise, interrogate each extension until there's a match
695 for name, path in paths.iteritems():
695 for name, path in paths.iteritems():
696 ext = findcmd(cmd, name, path)
696 ext = _finddisabledcmd(ui, cmd, name, path, strict=strict)
697 if ext:
697 if ext:
698 break
698 break
699 if ext:
699 if ext:
General Comments 0
You need to be logged in to leave comments. Login now