Tag

Grieving the loss of his email code, Harry creates a tag so he can quickly find it.

lottery harry$ hg log
...
changeset:   13:4ac7113cd126
user:        Harry <harry@futilisoft.com>
date:        Tue May 17 14:01:51 2011 -0500
summary:     add libvmime so we can do the mail reader feature
...

lottery harry$ hg tag -r 4ac7113cd126 just_before_sally_deleted_my_email_code

Harry could have typed -r 13, using the local revision number instead of the changeset ID.

lottery harry$ hg log
changeset:   16:f282002d72ee
tag:         tip
user:        Harry <harry@futilisoft.com>
date:        Tue May 17 14:14:44 2011 -0500
summary:     Added tag just_before_sally_deleted_my_email_code for changeset 4ac7113cd126

changeset:   15:8ac66a135f35
user:        Sally <sally@futilisoft.com>
date:        Tue May 17 14:11:45 2011 -0500
summary:     use strtol. atoi is deprecated.

changeset:   14:a3a4497e7ff6
user:        Sally <sally@futilisoft.com>
date:        Tue May 17 14:04:44 2011 -0500
summary:     no mail reader until 2.0

changeset:   13:4ac7113cd126
tag:         just_before_sally_deleted_my_email_code
user:        Harry <harry@futilisoft.com>
date:        Tue May 17 14:01:51 2011 -0500
summary:     add libvmime so we can do the mail reader feature
...

I gotta admit I’m not too fond of the way Mercurial handles tags. They’re stored in a special .hgtags file in the version control tree. This means that applying a tag causes another commit. If you want your continuous integration system to apply a tag to mark the revision on which every build is done, you have to teach it to ignore changesets where nothing happened except the addition of a tag; otherwise it’ll tag itself into an infinite loop.

lottery harry$ hg push
pushing to http://server.futilisoft.com:8000/
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files

Sally sees Harry gloating in the company chat room about his beloved tag, so she does an update.

lottery sally$ hg pull
pulling from http://server.futilisoft.com:8000/
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
(run 'hg update' to get a working copy)

lottery sally$ hg update
1 files updated, 0 files merged, 0 files removed, 0 files unresolved

lottery sally$ hg parents
changeset:   16:f282002d72ee
tag:         tip
user:        Harry <harry@futilisoft.com>
date:        Tue May 17 14:14:44 2011 -0500
summary:     Added tag just_before_sally_deleted_my_email_code for changeset 4ac7113cd126

Sally sees Harry’s tag and rolls her eyes. Fine. Whatever.