Mercurial > public > mercurial-scm > hg-stable
diff hgext/mq.py @ 28313:aa73d6a5d9ea
dispatch: store norepo/optionalrepo/inferrepo attributes in function (API)
This can eliminate import cycles and ugly push/pop of global variables at
_checkshellalias(). Attributes of aliascmd are directly accessible.
Because norepo/optionalrepo/inferrepo lists aren't populated, extensions
examining them no longer work. That's why this patch removes these lists
to signal the API incompatibility.
This breaks 3rd-party extensions that are yet to be ported to @command
decorator.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 01 Jan 2016 22:16:25 +0900 |
parents | db24d6888896 |
children | dcb4209bd30d |
line wrap: on
line diff
--- a/hgext/mq.py Sat Jan 09 20:04:03 2016 +0900 +++ b/hgext/mq.py Fri Jan 01 22:16:25 2016 +0900 @@ -3560,12 +3560,11 @@ entry = extensions.wrapcommand(commands.table, 'init', mqinit) entry[1].extend(mqopt) - nowrap = set(commands.norepo.split(" ")) - def dotable(cmdtable): - for cmd in cmdtable.keys(): + for cmd, entry in cmdtable.iteritems(): cmd = cmdutil.parsealiases(cmd)[0] - if cmd in nowrap: + func = entry[0] + if func.norepo: continue entry = extensions.wrapcommand(cmdtable, cmd, mqcommand) entry[1].extend(mqopt)