Changing command tables
Matt Mackall
mpm at selenic.com
Sun Apr 20 21:05:34 UTC 2014
On Fri, 2014-04-18 at 23:27 -0700, Gregory Szorc wrote:
> Downside: Writing dual compatible extensions is annoying. You probably
> have to fall back to "decorators are just function wrappers" and do
> something like:
>
> def mycommand(ui, *args, **kwargs):
> """The body of hg mycommand."""
>
> try:
> mycommand = command(mycommand, '^mycommand', [...], _('hg
> mycommand'), norepo=True)
> except Exception:
> mycommand = cmdutil.command(cmdtable)(mycommand, '^mycommand',
> [...], _('hg mycommand'))
> commands.norepo += ' mycommand'
>
> That's yucky.
You should probably consider "solving the backwards-compatibility with
an ever-changing API" out of scope for this discussion because it's a
far bigger problem than this that extension developers are going to have
to deal with anyway.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list