[PATCH] record: use cmdutil.command decorator

Idan Kamara idankk86 at gmail.com
Sun May 22 09:02:42 CDT 2011


On Sun, May 22, 2011 at 4:49 PM, timeless <timeless at gmail.com> wrote:

> On Sun, May 22, 2011 at 6:30 AM, Idan Kamara <idankk86 at gmail.com> wrote:
> > record: use cmdutil.command decorator
>
> > +cmdtable = {}
> > +command = cmdutil.command(cmdtable)
> > + at command("record",
> > +         commands.table['^commit|ci'][1], # same options as commit
> > +          _('hg record [OPTION]... [FILE]...'))
>
> > -cmdtable = {
> > -    "record":
> > -        (record, commands.table['^commit|ci'][1], # same options as
> commit
> > -         _('hg record [OPTION]... [FILE]...')),
> > -    "qrecord":
> > -        (qrecord, {}, # placeholder until mq is available
> > -         _('hg qrecord [OPTION]... PATCH [FILE]...')),
> > -}
>
> this seems like you'll break hg help qrecord in some case, did all the
> tests pass?
>

Yes they did.

There's a trick there (which I wanted to document but forgot...) for hg help
qrecord: it steals the options from qnew, which is only available if mq is
loaded.
But since we want "hg help qrecord" to still suggest which extensions to
enable even if mq is disabled, it adds an entry to the cmdtable with no
options.
It's a bit unfortunate but I couldn't think of a way to fix that...

Anyway, I didn't touch that part (unless I screwed up).


> -- sorry, i'm @MeeGo Conf SF and don't have time to play (my Phone
> thought it was @AMS and decided to alarm +9hrs early...).
>
> > +cmdtable["qrecord"] = \
> > +    (qrecord, {}, # placeholder until mq is available
> > +     _('hg qrecord [OPTION]... PATCH [FILE]...'))
>
> > -    qcmdtable = {
> > -    "qrecord":
> > +    cmdtable["qrecord"] = \
> >         (qrecord, mq.cmdtable['^qnew'][1], # same options as qnew
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20110522/4918cab9/attachment.htm>


More information about the Mercurial-devel mailing list