Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mercurial: branch conflicts with tag

I have created a branch and tag with the same name: 0.2.0. I have encountered some problems with merging, but managed to overcome them, using -r and providing explicit revision. So it is not my question what to do. Rather I would like to know: is it a suggested to have a different names for a branch and a tag, when a new version is produced? Are there any standard names for those tags and branches?

like image 219
gruszczy Avatar asked Apr 15 '11 22:04

gruszczy


2 Answers

I would tag the code with version numbers like you do, e.g., 1.0, 2.0 and so on. For maintenance branches I would use 1.x, 2.x, etc.

The 1.1 tag would then be made on the 1.x branch and the 1.0 changeset is the fork point for the 1.x branch. It is not on the branch since you only create the 1.x branch when you need to make a 1.1 bugfix release.

Finally, you can use the revset language to distinguish between a tag and a branch:

$ hg log -r 'branch(foo)'
$ hg log -r 'tag(foo)'
like image 151
Martin Geisler Avatar answered Nov 15 '22 11:11

Martin Geisler


With the possible exception of default, there are no standard names for branches or tags in Mercurial. Your branch/tag naming scheme would be dictated by your development process.

I don't think using the same name for a named branch and a tag is a good idea, however. Typically you can execute hg update <name> and as long as <name> matches either a named branch or a tag, Mercurial will resolve the name and take you there. But, if you have both a branch and a tag with the same name, it has no way of differentiating between the two, and will take you to one. Of course, you could specify the revision explicitly, but that kind of defeats the convenience of using names.

like image 30
dls Avatar answered Nov 15 '22 11:11

dls