[PATCH] tag: allow multiple tags to be added or removed
John Coomes
John.Coomes at sun.com
Tue Mar 11 08:53:53 UTC 2008
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
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.
> > - _('hg tag [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME')),
> > + _('hg tag [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME ...')),
>
> Just NAME... here.
Will fix.
> > - def tag(self, name, node, message, local, user, date):
> > - '''tag a revision with a symbolic name.
> > + def tag(self, names, node, message, local, user, date):
> > + '''tag a revision with one or more symbolic names.
>
> localrepo.tag() is part of the API, so it should still accept a
> single tag as string, too.
Should have realized it was part of the API. Will fix.
-John
More information about the Mercurial-devel
mailing list