Symlinks to .hg directories

Sébastien Pierre sebastien.pierre at gmail.com
Tue Jan 31 21:44:31 UTC 2017


Hi all,

I'm trying to find a way to optimize disk space for the following situation.

I have a *LIBS* repository that aggregates a dozen of repository from
GitHub/BitBucket as subrepositories.

LIBS/.hg
LIBS/.hgsub
LIBS/deps/<SUBMODULE_01>/.hg
LIBS/deps/<SUBMODULE_02>/.hg
..
LIBS/deps/<SUBMODULE_10>/.hg

I have dozens of *PROJECT_NN *repositories that each include *LIBS *as a
subrepository (each project might use a specific revision of *LIBS*).

The problem is that for each clone of *LIBS*, Mercurial does a fresh clone
of each *SUBMODULE_NN* directly from the provider (eg. GitHub/BitBucket),
preventing to use the nice hardlink optimization of local repositories.

To work around that, I wrote a simple script that clones the SUBMODULE_NN
repositories in ~/.cache/LIBS/deps/<SUBMODULE_NN> and replace
each LIBS/deps/<SUBMODULE_01>/.hg in each PROJECT_NN by a symlink to
~/.cache/LIBS/deps/<SUBMODULE_NN>.

As you can see, the idea is to have a local centralised place for all the
SUBMODULE_NN repositories and re-use their .hg repository by using
symlinks. However, this does not seem to work well -- I keep running into
mysterious errors and undefined behaviour.

Any suggestions on how do achieve de-duplication without the problems
introduced by the shared .hg directory?

Thanks,

-- Sébastien
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial/attachments/20170131/75dda703/attachment.html>


More information about the Mercurial mailing list