Getting time stamp of a tag

Robert Bauck Hamar r.b.hamar at usit.uio.no
Wed May 19 09:36:25 UTC 2010


*FUJIWARA Katsunori:
>
>At Wed, 19 May 2010 00:09:51 +0000,
>TK Soh wrote:
>> 
>> On Tue, May 18, 2010 at 5:57 PM, Matt Warren <matt.warren at gmail.com> wrote:
>> > Got a solution that works.
>> >
>> > tag=build-2348
>> > hg log --template='{date|isodate} {desc|firstline}\n' .hgtags | \
>> > awk "/Added tag $tag for changeset/{print \$1;}"
>> >
>> > The "Added tag..." comment is added to the revision after the one
>> > actually tagged.
>> 
>> The message format "Added tag..." may not be always as consistent. If
>> the .hgtags file has been edited manually, or if the a tagging
>> changeset uses custom message, then most likely the solution will
>> break.
>
>How about "hg annotate -d .hgtags | grep build-2348" ?

It is not guaranteed to work, as the tags are taken from the heads of 
the repo, not the w. Also, you might hit tag build-23480, 
but thats easily fixable.

hg grep -qd "$(hg id -ir $tag).*\\s$tag\$" .hgtags| cut -d: -f3

By also searching with the changeset id, (the hg id -ir $tag part), you 
would also not hit redefinitions of the same tag.

But this solution still trusts the timestamp of the tagging changeset. 
This might not be accurate, as

1. one can set the date with the -d option
2. it is not more accurate than the clock on the tagger's computer.

Also, the push time might be a better measure on when the tagging was 
done. This can be recorded with a hook on the central repository.

-- 
Robert Bauck Hamar
USIT/SAPP/GT - Cerebrum
http://www.uio.no/sok?person=roberth
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20100519/7016a7f3/attachment.asc>


More information about the Mercurial mailing list