Tag keyword (keyword extension)

Benno Dielmann lists at benno-dielmann.de
Sun Jul 13 06:33:14 CDT 2008


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? To reproduce, just 
clone some repository,
$ hg tag "test"
change something somewhere, 
$ hg ci -m "test"
Now, the Revision keyword expands to the changeset number of 
$ hg parent
Everything's ok. Now if you
$ hg update -C -r [one revision number back]
the Revision keyword doesn't expand to the changeset number of the actual 
parent, but to the number of the parent's parent (the changeset we actually 
tagged). Maybe it's a feature - then it should be documented somewhere, 
shouldn't it?

Greets, Benno.


More information about the Mercurial mailing list