Symlinks to .hg directories

Augie Fackler lists at durin42.com
Tue Jan 31 22:03:51 UTC 2017


On Tue, Jan 31, 2017 at 4:44 PM, Sébastien Pierre
<sebastien.pierre at gmail.com> wrote:
> 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?

Have you tried https://www.mercurial-scm.org/wiki/ShareExtension?



More information about the Mercurial mailing list