Is it okay that .hgtags exists in default branch, but not in develop branch?
Asked by ralvy:

In one of my repos, when I check out my default branch, I see an .hgtags file there. But it disappears when I check out my develop branch. Is this a problem?


Answers:
author: minnsey
body: Hi  

.hgtags contains the global tag names. It is a version controlled file so it should be in your repository, but depending on when it was created vs the develop branch it is possible it is in one branch but not the other.

comments: author: ralvy
body: I imagine that if I add a tag to my develop branch, I will magically get a .hgtags file for that branch. I don't add tags to the develop branch, as a rule. Only to the default branch to track version numbers. But repositories where I \*do\* have an .hgtags file in develop, show it has only the initial commit version number tag in it, where the default branch .hgtags has all the tags I use for version numbers in default.


author: ralvy
body: What would happen if I copy the .hgtags file I see in the default branch into my develop branch?

The reason I ask is that, because my develop branch lacks an .hgtags file, I always have to make sure that the last Push I do from my MacBook Pro is with a changeset in my develop branch. Otherwise when I do a Pull on my Mac Mini, I'm told that

hg cat' failed with code 1:'.hgtags: no such file in rev ...

Or should I just create a tag on my develop branch?


author: ralvy
body: ![SourceTree_NoHgTagsFile.png](https://community.atlassian.com/t5/image/serverpage/image-id/39765i1011D6B3677987DC/image-size/large?v=v2&px=999 "SourceTree_NoHgTagsFile.png")

I see now why this happened, as you can see in the above image. I mistakenly created the develop branch BEFORE committing the initial tag creation. Will this Pull problem go away if I just add a tag to my most recent develop changeset?


author: minnsey
body: To be honest I don't know, it might be a question the Mercurial mailing lists can answer better. <https://www.mercurial-scm.org/wiki/MailingLists>  

But I can't see any downside to trying.  

Sorry its not a definitive answer.


author: ralvy
body: Thanks for your time on this, Michael.


author: ralvy
body: I checked out the tip of develop and then added a tag to the first develop changeset. So that tag now appears on the first develop changeset and in the left column of tags.

I then merged develop to default and resolved the conflict on .hgtags to keep "Mine". When I do this, however, the tag disappears on the first develop changeset and disappears from the left column of tags.

However, develop now has a .hgtags file with that single tag referencing the first develop changeset and I don't get the Pull problems I was having before. But I'm concerned about the tag no longer appearing in Sourcetree. So I'm reticent to actually do this with my production repository. I did all this on a test local/remote repository.

I'm tempted to create a new repository for this code and do it properly this time, so develop is created AFTER I create my first default tag.


author: ralvy
body: I resolved this by simply copying my latest source code over to a new folder and created a repository there, properly this time. I can always go back to the prior repo if I need to access older versions of this source code.


Tags: mercurial