When does it make sense to use subrepositories?

Matt Mackall mpm at selenic.com
Thu Apr 18 18:52:11 UTC 2013


On Thu, 2013-04-18 at 09:36 -0700, v wrote:
> I've just backed out of several hours' work transitioning a set of related
> projects from one repository to a group of subrepositories. Having been
> through this a few times before, I always seem to end up with one of two
> scenarios:
> 
> - If changes to one project are usually associated with changes to other
> related projects, put them in the same repository.
> - Otherwise, use separate repositories, and handle the relationship with you
> favourite dependency management solution. If you really want to do this with
> your SCM, then use guestrepos.
> 
> I do acknowledge that subrepos are now declared "a feature of last resort",
> but I'm wondering what this situation is. Someone paid for them to be
> developed, so they must be useful somewhere!

Most people are unclear on the fundamental purpose of version control.
They think of VCSes as first and foremost a tool to synchronize code
between developers. But this is wrong; it is a description of rsync. The
primary purpose of an VCS is to precisely track old states of the
project for future reference. 

With that in mind, ask yourself the question:

"Do I need to be able to reproduce an exact combination of independent
projects from the past in the future?"

In other words, "do I need _version control_ on my combination of
projects?"

If the answer is yes, your options are:

- check everything into one repo and hope you don't have to merge in
"upstream" changes often
- use subrepos

-- 
Mathematics is the supreme nostalgia of our time.





More information about the Mercurial mailing list