Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial - should .hgtags be merged?

If you are merging changes from repository B into repository A should you merge changes in .hgtags?

Repository B could have had tags 1.01, 1.02, 1.03 which are not in A. Why would you ever merge those into repository A's .hgtags file? If we merged and then tried to view repository A by looking at tag 1.01, I would think this wouldn't work.

like image 888
Marcus Leon Avatar asked Feb 22 '11 15:02

Marcus Leon


People also ask

How do I merge branches in Mercurial?

In the Merge dialog that opens, choose the target repository from the Repository list which shows all the Mercurial repositories available under the current project root. Choose the Branch or Bookmark option and choose the named branch or bookmark to merge the current working directory with.

How to remove tag in hg?

If you want to remove a tag that you no longer want, use hg tag --remove . You can also modify a tag at any time, so that it identifies a different revision, by simply issuing a new hg tag command. You'll have to use the -f option to tell Mercurial that you really want to update the tag.

What is HG graft?

hg graft has additional functionality over and above simple cherry picking of one revision. For example, you can graft a range of revisions onto another branch.

What is hg tags?

Thus Mercurial stores tags as a file in the working dir. This file is called . hgtags and consists of a list of changeset IDs and their corresponding tags. To add a tag to the system, simply add a line to this file and then commit it for it to take effect.


1 Answers

Short Answer: This does work properly and you should merge .hgtags

Why should you actually merge .hgtags and why does it make sense?

So you have

  • Repo A with Changesets 3 (a1), 4 (a2), 5 (a3)
  • Repo B with Changesets 3 (b1), 4 (b2), 5 (b3) tag 1.01

The above is listed as the Changeset Number (long unique hex id) tag

So you merge repo B into Repo A and get something that looks like.

      9 (a4) merge 
     /   \
    |   8 (b3) tag 1.01
    |    |
    |   7 (b2)
    |    |
    |   6 (b1)
 5 (a3)  |
    |    |
 4 (a2)  |
    |    |
 3 (a1)  |
     \   /
     2 (a0) 

If you update the repo to tag 1.01 you will get exactly what the code looked like at that point in time When it was in Repo B just as mercurial promises.

You should merge them as the changesets from Repo B that were tagged are now part of the changeset tree in Repo A, so therefore the changesets you tagged in Repo B are now tagged in Repo A. Not merging them would just cause you to lose the tags that you created for the changesets.

like image 161
msarchet Avatar answered Oct 11 '22 10:10

msarchet