Working with hierarchical repositories

Greg Ward greg-hg at gerg.ca
Wed Sep 14 00:16:33 UTC 2011


On Tue, Sep 13, 2011 at 7:13 AM, Marco Gerber <mgerber at junisphere.net> wrote:
> My use case is as follows:
> We use eclipse to develop our software, and mercurial as a dvcs for our
> source code. So we have a .hg directory in our project folder which by
> itself is a folder inside the workspace. As eclipse manages part of the
> workspace and project configuration inside every project, we ignore all such
> files and directories. It would be nice for us to manage such files in a
> separate repository related to every depeloper and located local. This would
> enable us to setup a new workspace very fast as a simple clone would do all
> the work. However, mercurial doesn't allow to have parts of a working
> directory managed by repository A and others by repository B.
>
> How is it possible to manage such files by mercurial?

What's wrong with tracking Eclipse's project/classpath files just like
any other source code and build scripts? That's what we do and it
works fine. You probably already keep your
make/ant/scons/maven/whatever scripts under source control, so why not
IDE project files?

However, if you really want to move the Eclipse files out to another
repo, you could do something like this:

  * assume everyone has a clone called eclipse-files that is a sibling
    of their main working clone
  * create symlinks to ../eclipse-files/.project, or
    ../../../eclipse-files/sub/sub/.project, or whatever
  * commit those symlinks to your main repo -- if someone is missing
    the eclipse-files sibling, then they'll get dangling symlinks
    in their main working dir

Of course that assumes everyone is using Unix. ;-)

Greg



More information about the Mercurial mailing list