Why separate tags file in Mercurial
I have been reading about mercurial tags. I can see, usually, we tag a changeset开发者_JAVA技巧 to mark a release point and these tags are revision controlled too.
But I could not really understand the idea of having a .hgtags
file. What is the purpose of this file?
Having a .hgtags
file allows changes to the .hgtags
file to be recorded using the same format used to record changes to all other files. It also allows tags to be transferred between repositories in the same format used for transferring file changes.
This allows Mercurial to implement one system for storing changes to a directory, and one protocol for transferring a bunch of changes to a directory and have branching and tag information automatically handled in the when transferring file changes.
It also allows the one to view the history of the tags for a project, by looking at the history of the .hgtags
file.
Tag names in two related repositories may be conflicting.
E.G. The tag A may in one repo point on changeset id X and in another repo the same tag may point on changeset id Y. During merge this conflict has to be solved.
Conflicts during merge are solved by inspecting files and the associated modifications.
Hence, the tags has to be stored in an ordinary file in the repo.
I actually see no usage at all for having a separate tags file. Repository history (including tags) should be well viewed with a 'log' command. Having the tags file also breaks an important rule: a change that is related strictly to the versioning system should not alter the repository in any way.
精彩评论