Tag keyword (keyword extension)

Christian Ebert blacktrash at gmx.net
Sun Jul 13 08:46:48 CDT 2008


* Benno Dielmann on Sunday, July 13, 2008 at 13:33:14 +0200
> Am Sonntag, 13. Juli 2008 schrieb Martin Geisler:
>| Benno Dielmann <lists at benno-dielmann.de> writes:
>|> Another issue: When I do
>|> 
>|> $ hg tag "v0.1.1"
>|> 
>|> and
>|> 
>|> $ hg log
>|> changeset:   15:41ef68337479
>|> user:        Benno Dielmann <mail at benno-dielmann.de>
>|> date:        Sun Jul 13 00:12:03 2008 +0200
>|> summary:     Added tag v0.1.1 for changeset b96acc0afdd5
>|> 
>|> changeset:   14:b96acc0afdd5
>|> tag:         v0.1.1
>|> user:        Benno Dielmann <mail at benno-dielmann.de>
>|> date:        Sun Jul 13 00:11:54 2008 +0200
>|> summary:     Tag und Revisionsnummer werden im Fenstertitel angezeigt
>|> 
>|> ...
>|> 
>|> the $Revision$ still expands to b96acc0afdd5. Shouldn't it be
>|> 41ef68337479? Other revisions work well, but changesets caused by
>|> tagging always evaluate to one changeset before the actual parent.
>|> Is this a bug or a feature?
>| 
>| It's a feature :-) The effect you see is simply the result of how tags
>| are implemented in Mercurial: they are just recorded in a .hgtags file
>| which is versioned like any other file.
>| 
>| The file contains (changeset, tag) pairs, one on each line. When you
>| create a new tag a new line is added to the file which is then
>| committed. That unfortunately means that the tag for revision 14
>| becomes effective in revision 15 (when .hgtags was committed).
> 
> Yes, I know how tagging works in Mercurial. But since creating a tag is 
> followed by a normal commit, the repository gets a new changeset number. So 
> why doesn't it appear in the expanded Revision keyword?

Because "hg tag" changes .hgtags and refers to the revision in
question. The keyword $Revision$ refers to the changeset the file
containing the keyword was last changed.

I don't think what you want can be implemented:

"hg tag" sort of looks (points) *back* to a change.

How can the extension guess at a certain commit that this commit
will be tagged (in the future) and what the tagname will be?

Plus, the keyword extension works *filewise*, whereas the
tag has its meaning *repowide*. So your operation would have to
update all `hg kwfiles` ... doable, expensive, but when and with
what tagname?

You might consider whether the keyword extension is the right
tool for what you want, and whether this is not better
implemented via some hooks.

c
-- 
  Was heißt hier Dogma, ich bin Underdogma!
[ What the hell do you mean dogma, I am underdogma. ]

_F R E E_  _V I D E O S_  -->>  http://www.blacktrash.org/underdogma/


More information about the Mercurial mailing list