Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
508 views
in Technique[技术] by (71.8m points)

version control - Mercurial with multiple projects

I have a couple of projects with different release cycles sitting in my SVN repository. Releases are created by using the classic tags structure in SVN. When there are bugs to fix in releases a branch is created from a tag, the bug is fixed and then merged from there into trunk.

Now, for multiple reasons, I want to switch from SVN to mercurial with a central push site.

Question: Which is the best way in mercurial to organize multiple projects that share little code between them? Should I create multiple push sites, one for each project?

Please include in the answer a description on how to recreate my release-tag, bugfix branch, ... with your preferred version of repository design.

Edit: I would like to install as little extensions as possible.

Edit2:

Given this SVN layout:

.
|-- project-a
|   |-- branches
|   |   |-- 1.x
|   |   `-- feature-1
|   |-- tags
|   `-- trunk
`-- project-b
    |-- branches
    |-- tags
    |   |-- 1.0
    |   `-- 1.1
    `-- trunk

(thanks @bendin! :) )

Is it better to work with multiple hg push repositories

project_a-trunk
project_a-1.x
project_a-feature-1
project_b-trunk

for the branches. Tags are folded into the appropriate branch.

Or would you rather go with two push repositories in this example

project_a
project_b

with named branches and therefore multiple heads within one repo.

The advantage I see with the multiple heads repos is that I don't have to go hunt for a tag in multiple repos. The disadvantage I see is that the hg book seems to discourage multiple head repos. What would/do you do?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Some subversion repositories will group logically unrelated things (i.e. projects with different version numbers and release cycles) under one trunk:

.
|-- branches
|   |-- project-a-1.x
|   `-- project-a-feature-1
|-- tags
|   |-- project-a-1.0
|   |-- project-b-1.0
|   `-- project-b-1.1
`-- trunk
    |-- project-a
    `-- project-b

This kind of layout has no direct analog in mercurial. Each project which has its own release cycle and own version numbers should have its own repository.

Some subversion repositories are structured to do this by giving each project its own trunk, tags and branches:

.
|-- project-a
|   |-- branches
|   |   |-- 1.x
|   |   `-- feature-1
|   |-- tags
|   `-- trunk
`-- project-b
    |-- branches
    |-- tags
    |   |-- 1.0
    |   `-- 1.1
    `-- trunk

You can think of each project as a logical repository within your physical subversion repository. Each project has its own trunk, tags and branches. This also has the benefit that you can keep tag and branch names shorter because you already know which project they belong to.

This layout is also trivial to express with a tool like mercurial. Each "project" becomes a mercurial repository. Tags and branches within that repository are tags and branches of that project.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...