'hg tag' command - allow multiple tag names in one invocation?

John Coomes John.Coomes at sun.com
Fri Dec 7 06:20:48 CST 2007


Dirkjan Ochtman wrote:
> John Coomes wrote:
> > 'hg tag' currently accepts a single tag name; I'd like to extend it to
> > allow multiple tag names for a changeset (something our project will
> > use periodically).  Thus the usage line would become
> > 
> > 	hg tag [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME ...
> > 
> > I think the code changes are straightforward (although I haven't made
> > them yet), but wanted to get some opinions up front.  
> 
> It's not clear to me from this how a command adding two tags would look. 
> Would you mind providing an explicit example of what it looks like with 
> more than one tags (and what changes for the single-case tag, if needed)?

Sorry, examples would have been appropriate.  Here they are ...

1.  I want to add two tags ("build-25" and "beta-1") for revision 42.
I'd like to type this:

	$ hg tag -r 42 build-25 beta-1

The current hg prints a deprecation warning, and also fails because
the second argument (beta-1) is interpreted as a revision:

	use of 'hg tag NAME [REV]' is deprecated, please use
	    'hg tag [-r REV] NAME' instead
	abort: use only one form to specify the revision

2.  Add two tags ("build-25" and "beta-1") for the default revision.
(The method of selecting the default would not change.)  I'd like to
type this:

	$ hg tag build-25 beta-1

The current hg prints a deprecation warning and fails because revision
beta-1 doesn't exist:

	use of 'hg tag NAME [REV]' is deprecated, please use
	    'hg tag [-r REV] NAME' instead
	abort: unknown revision 'beta-1'!

It's worth noting that if beta-1 is replaced with something that names
a valid revision (e.g., tip), the current hg would succeed (it would
add tag build-25 for that rev).

3.  Add a single tag, avoiding deprecated syntax.  These are unchanged
w/my proposal.

	$ hg tag -r 42 build-25
	-or-
	$ hg tag build-25

The sticky part is that my proposal would change the meaning of
deprecated (but accepted) syntax, as in example 2.  If necessary, I
could modify the proposal slightly to could require an additional
option, call it '-x' for now, to enable multiple tags.  Then examples
1 and 2 above become

	1.  hg tag -r 42 -x build-25 beta-1
	2.  hg tag -x build-25 beta-1

The commands in example 3 wouldn't change; they would work identically
with or without the '-x' option.

-John



More information about the Mercurial-devel mailing list