开发者

Mercurial: Why would you maintain separate branches/versions of software in separate cloned repos rather than with tags?

开发者 https://www.devze.com 2022-12-10 00:29 出处:网络
I\'m looking at the mercurial handbook, chapter 6 \"Working with multiple branches\". In there the author states that if you have separate versions/branches of the same software that it makes sense in

I'm looking at the mercurial handbook, chapter 6 "Working with multiple branches". In there the author states that if you have separate versions/branches of the same software that it makes sense in an implied obvious way to host each branch of the software in a separate repository.

I know that Mercurial supports tags (which is the way that branches are done in subversion AFAIK). Why would you use different repositories instead of tags for branch开发者_Python百科 managing?


Mercurial's tags are not the same as Subversion's branches. In Subversion, making a branch creates a separate copy of the code (with hardlinks at least, I think) while tags in Mercurial just point to a specific commit.

A while ago I wrote about Mercurial's branching models (of which branching-with-clones is one of four options), maybe you'd find it useful?


There are advantages in having different repositories in Mercurial, and problem in handling branches.

Branches mean multiple heads, the graphs are much more complicated then, and even the graphical representation may not be able to accommodate so many convoluted paths... and I don't even talk about the human brain!

On the other hand, having multiple repositories mean that each repository will have a much simpler structure, therefore easing the brain trauma of having to deal with multiple branches/merges (that you have anyway, since two developers working from the same changeset and onward develop concurrently).

Furthermore, with multiple repositories, you can read/edit any file on a given repository easily with whatever editor you are using (if you maintain the working dir up to date relatively to the tip).

On subversion you HAVE to deal with multiple branches, there is no other way around, and you have to use tags.

On Mercurial, tags are not supposed to move (it needlessly introduce changesets) and branches are handled off-the-shelf: you always have branches. However, since you can have multiple repositories, you are offered another dimension. It is your choice whether you use it or not, it made my life easier anyway.

0

精彩评论

暂无评论...
验证码 换一张
取 消