Alex Rivera | Logout

Mercurial with multiple projects

Asked 2009-05-30T10:35:06.460
32

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?

Edit
Report

1 Answer

8

Like bendin says, you should create multiple repositories, one for each independent project as a start.

Mercurial commits are made an a repository-wide level and you cannot checkout just a single subdirectory. This is unlike Subversion which allows you to make in-consistent commits by commiting only some files, but then it also allows you to checkout just a single subdirectory.

When you make a release you will typically add a tag to your Mercurial repository (hg tag). You can freely decide if you want to keep a bugfix repository around for each release, of if you want to create them when needed the first time. The trick is that

% hg clone -r 1.0 project-a project-a-1.0.x

can be used to create a repository project-a-1.0.x which only has the history up to the tag 1.0. You can then fix the bug in project-a-1.0.x and push it back to project-a. Further bugfixes can be made in the project-a-1.0.x repository.

answered 2009-05-30T15:19:42.580

Your Answer