[PATCH] tag: allow multiple tags to be added or removed
John Coomes
John.Coomes at sun.com
Tue Mar 11 19:23:34 UTC 2008
Matt Mackall (mpm at selenic.com) wrote:
> 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
> >> ...
> >> 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.
Definitely simpler, and the odds of multiple errors are pretty low
here, so I'll make the change. I went down the path of listing all
errors because I get frustrated by compilers and other tools that give
up at the first error, only to make you rerun again to find the next
one.
> > 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.
No problem. Say we've run the commands "hg tag beta-1" and "hg tag
beta-2 build-24". What should the respective commit messages look
like?
(a) Added tag beta-1 for changeset abcdefabcdef
Added tag beta-2, build-24 for changeset fedcbafedcba
(b) Added tag beta-1 for changeset abcdefabcdef
Added tag beta-2 and tag build-24 for changeset fedcbafedcba
(c) Added tag(s) beta-1 for changeset abcdefabcdef
Added tag(s) beta-2, build-24 for changeset fedcbafedcba
(a) is closest to the existing message, if just slightly ambiguous;
(b) is unambiguous, but a bit more verbose; (c) is a commonly-used but
unattractive variant listed for completeness. I like (a) or (b), w/a
slight preference for (b).
-John
More information about the Mercurial-devel
mailing list