Mercurial > public > mercurial-scm > hg-stable
diff mercurial/dispatch.py @ 30494:acd30a959980
dispatch: stop supporting non-use of @command
We said we'd delete this after 3.8. It's time.
author | Augie Fackler <augie@google.com> |
---|---|
date | Mon, 21 Nov 2016 21:51:23 -0500 |
parents | 39d13b8c101d |
children | fc0cfe6c87d7 |
line wrap: on
line diff
--- a/mercurial/dispatch.py Mon Nov 21 20:12:51 2016 -0800 +++ b/mercurial/dispatch.py Mon Nov 21 21:51:23 2016 -0500 @@ -714,14 +714,6 @@ return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d, [], {}) -def _cmdattr(ui, cmd, func, attr): - try: - return getattr(func, attr) - except AttributeError: - ui.deprecwarn("missing attribute '%s', use @command decorator " - "to register '%s'" % (attr, cmd), '3.8') - return False - _loaded = set() # list of (objname, loadermod, loadername) tuple: @@ -854,7 +846,7 @@ with profiling.maybeprofile(lui): repo = None cmdpats = args[:] - if not _cmdattr(ui, cmd, func, 'norepo'): + if not func.norepo: # use the repo from the request only if we don't have -R if not rpath and not cwd: repo = req.repo @@ -877,9 +869,8 @@ except error.RepoError: if rpath and rpath[-1]: # invalid -R path raise - if not _cmdattr(ui, cmd, func, 'optionalrepo'): - if (_cmdattr(ui, cmd, func, 'inferrepo') and - args and not path): + if not func.optionalrepo: + if func.inferrepo and args and not path: # try to infer -R from command args repos = map(cmdutil.findrepo, args) guess = repos[0]