[PATCH] tag: allow multiple tags to be added or removed
Matt Mackall
mpm at selenic.com
Tue Mar 11 17:09:59 UTC 2008
John Coomes wrote:
> Thomas Arendsen Hein (thomas at intevation.de) wrote:
>> * John Coomes <John.Coomes at sun.com> [20080223 09:33]:
>>> Patch to allow multiple tags to be added/removed in a single invocation
>>> of hg tag. Basic example of the new usage is
>>>
>>> hg tag -r 42 build-25 beta-1
>>>
>>> which adds tags 'build-25' and 'beta-1' for rev 42.
>> Generally I want this, but some comments on the implementation.
>
> Great! Hopefully I can get an updated patch out later today.
>
>>> -def tag(ui, repo, name, rev_=None, **opts):
>>> - """add a tag for the current or given revision
>>> +def tag(ui, repo, name1, *othernames, **opts):
>>> + """add one or more tags for the current or given revision
>> Just "name, names" or "name1, names"? We don't have the other...
>> notation in other parts of the code.
>
> Will do.
>
>> ...
>> Generally we try to avoid singular vs. plural messages to make
>> parsing such messages (automatically and by brain) easier.
>>
>>> + abort_nonempty([n for n in names if n in ['tip', '.', 'null']],
>>> + _('the name %s is reserved'),
>>> + _('the names %s are reserved'))
>> Maybe just loop over reserved names with singular message here.
>
> Would this be acceptable?
>
> $ hg tag -r 42 tip null
> tag: the name 'tip' is reserved
> tag: the name 'null' is reserved
> abort: reserved tag name
It would be simpler if it just aborted on the first problem.
> Or if there is a recommended format for such messages, let me know.
>
>>> + tag_word = (len(names) > 1 and _('tags')) or _('tag')
>> Some languages use singular for 21, 31, ... so this will get you (or
>> others) in translation hell :)
>
> I'll use i18n.t.ngettext() for this as suggested by Martin.
No, don't. We intentionally ignore the whole pluralization issue, it's
just not worth the complexity. For us or for parsers.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list