comparison mercurial/dispatch.py @ 28623:38dc3f28f478

dispatch: show deprecation warning if command has no attributes (issue5137) norepo/optionalrepo/inferrepo were removed by aa73d6a5d9ea, which would be significant API change. This patch tries to avoid crash even if ancient third-party extensions are enabled.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 09 Jan 2016 22:46:26 +0900
parents 527cf881d000
children 6b3b958daf03
comparison
equal deleted inserted replaced
28622:527cf881d000 28623:38dc3f28f478
745 d = lambda: fn(ui, *args[1:]) 745 d = lambda: fn(ui, *args[1:])
746 return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d, 746 return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d,
747 [], {}) 747 [], {})
748 748
749 def _cmdattr(ui, cmd, func, attr): 749 def _cmdattr(ui, cmd, func, attr):
750 return getattr(func, attr) 750 try:
751 return getattr(func, attr)
752 except AttributeError:
753 ui.deprecwarn("missing attribute '%s', use @command decorator "
754 "to register '%s'" % (attr, cmd), '3.8')
755 return False
751 756
752 _loaded = set() 757 _loaded = set()
753 758
754 # list of (objname, loadermod, loadername) tuple: 759 # list of (objname, loadermod, loadername) tuple:
755 # - objname is the name of an object in extension module, from which 760 # - objname is the name of an object in extension module, from which