newbie - sharing some files in a repository
Wagner Bruna
wagner.bruna+mercurial at gmail.com
Sat May 1 20:09:29 UTC 2010
Hello,
Ken Halprin wrote:
>>> I have a question about how to setup a set of repositories to handle a
>>> situation like this. We have multiple projects (VS solutions) in a
>>> product. Many of the projects share a set of files through a
>>> SourceSafe database. The shared files are a set of c++ base class
>>> files. All the projects that share those base class files also have
>>> their own specific derived class files which aren't shared. The
>>> derived class files have the same name across all the projects (ie,
>>> 'Derived.cpp') but contain code specific to the project. This allows
>>> us to update/fix base class files in one place.
>>>
>>> How can I create a similar structure using Mercurial repositories?
[subrepos]
> I'll check into that...but is there another way of looking
> at this that is more in line with the way Mercurial works?
Having used both branches and subrepositories for this, I'd say it all depends on the
behaviour you want when updating the base classes on each project:
1. you could simply have a separate repository for the base classes, in a sibling or
nested folder, and point to that when building. It'd be very easy to update the base
classes to any revision you need, but Mercurial wouldn't do anything to couple
together the revisions; you'd have to do that through other means (your build system,
repository hooks, ...);
2. as Mads suggested, keep the base classes on a subrepository. I believe most users
would choose this way;
3. you could keep all base classes alone in a repository, and propagate them around
as if they were branches. It involves a bit more work for updates to common code
(you'll always need merges), but it's just the usual Mercurial work with branches,
and it has a couple of advantages over subrepositories (the common files don't need
to be in the same directory, for instance).
Regards,
Wagner
More information about the Mercurial
mailing list