The short answer:
Yes, with a DVCS, you should use at least one separate repo per project, including shared projects and libraries.
The long answer:
We had basically the same setup here at Fog Creek when we were using Subversion. One big repo for everything. When we switched over to Mercurial, we quickly learned that DVCSs don't work the same way, and aren't really suited for one large repository like that. Now we have several repositories for each project.
For example, with Copilot, we have several different moving parts that are relatively independent of each other:
- Helpers (downloadable EXE clients)
- Reflector (server that links communication between helpers)
- Billing System
- Aardvark (shared library used by the reflector, website, and billing system)
For each of those parts, we've created a separate repository group and we keep a
stable repository in each of those groups. New features go into
devel and eventually get merged forward to
stable, while bug fixes go into
stable and get merged back into
To keep everything in sync for deploy, we use tags. In Subversion, tags are a pain because they're really not a tag as much as they are a full copy of your code in a different directory. With Mercurial, a tag is more like meta data on the repository, and you just treat them like a version number.
So let's say I need to deploy a new version of the Copilot website. To do it, I'll need a copy of
website-stable and a copy of
aardvark-stable. First, I tag each of those repos on my local machine (we have a batch file that does it for us, calculating out the tag number, e.g.
Website000123). Then we kick off the build process with our tag, which clones both repos from the server into a build directory and runs
hg up -C Website000123 to update them to the tag. Then it builds and deploys.
If I ever need to go back in time to that particular build, I can just run the same command,
hg up -C Website000123 in each repo. You should notice that we tag both the Website and the Aardvark repos with
Website000123, instead of tagging Aardvark with
Aardvark000123. This is because we'll also be tagging Aardvark for our reflector builds (
Reflector000456) when they go out, and we want to be able to know which was which.
We're currently working on some in-depth tutorials on exactly these sorts of topics. In the meantime, the following SE pages are a good start on some of the repo management topics I've mentioned here:
Update: The long-promised tutorial is out! Check it out HgInit.com