##// 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 655 if name in paths:
656 656 return _disabledhelp(paths[name])
657 657
658 def disabledcmd(ui, cmd, strict=False):
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):
658 def _finddisabledcmd(ui, cmd, name, path, strict):
667 659 try:
668 660 mod = loadpath(path, 'hgext.%s' % name)
669 661 except Exception:
@@ -685,15 +677,23 b' def disabledcmd(ui, cmd, strict=False):'
685 677 cmd = aliases[0]
686 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 688 ext = None
689 689 # first, search for an extension with the same name as the command
690 690 path = paths.pop(cmd, None)
691 691 if path:
692 ext = findcmd(cmd, cmd, path)
692 ext = _finddisabledcmd(ui, cmd, cmd, path, strict=strict)
693 693 if not ext:
694 694 # otherwise, interrogate each extension until there's a match
695 695 for name, path in paths.iteritems():
696 ext = findcmd(cmd, name, path)
696 ext = _finddisabledcmd(ui, cmd, name, path, strict=strict)
697 697 if ext:
698 698 break
699 699 if ext:
General Comments 0
You need to be logged in to leave comments. Login now