We just started using hg and we’re using base tags for common modules in our system. I have a few questions about how tags work.
-
(#1) When I add a tag using the following command, does it automatically check in the .hgtags file for me?
hg tag MY_TAG
-
When I add a tag for the first time, it adds a line to the the .hgtags file. When I do a -f (force) on the tag command, it adds another entry to the file. Then, when I remove it, it adds 2 more lines to the .hgtags file. Ultimately my file ends up looking like this:
af9e9bf4cf004a7fab4f911e95d1002579fd851a MY_TAG //from initial tag af9e9bf4cf004a7fab4f911e95d1002579fd851a MY_TAG //from delete (1/2) 0000000000000000000000000000000000000000 MY_TAG //from delete (2/2) 4611114976f02dd0d4f8ec9e84266dcea161cd3f MY_TAG //from tag after pull 0426c9e6e0ccf01e6d18d85420466d1edd1bff1f MY_TAG //from forced tag
-
(#2) Why does it keep adding lines to the .hgtags file? When I’m doing a base tag, I only really care to have a single entry in the file. Should I care about this bloat? Do I have to manually manage the .hgtags file to work in this way?
-
(#3) Also, do the delete lines have to remain contiguous in the file?
-
(#4) Is the file read from top to bottom, or does Mercurial actually find the latest changeset and use that one when I move to a tag?
MY_TAGis used as the tag.There’s really no reason not to edit the tags file if you need to clean something up. In general, tags shouldn’t move, and if you’re wanting to move them frequently, you may want to look into bookmarks instead.