When repositories are cloned locally, their data files will be hardlinked so that they only use the space of a single repository.

Unfortunately, subsequent pulls into either repository will break hardlinks for any files touched by the new changesets, even if both repositories end up pulling the same changes. Also, pulling with --rev never uses hardlinks.

You can recreate those hardlinks and reclaim that wasted space using the Relink Extension. Enable it:

relink =
# optionally specify the origin, if you do this a lot:
default-relink = ../incoming

and run it:

$ hg relink
relinking /home/hacker/src/incoming to /home/hacker/src/work
collected 9999 candidate storage files
pruned down to 5555 probably relinkable files
relinked 4444 files (12345678 bytes reclaimed)

In Mercurial 1.3.1 and older (prior to Issue919), contrib/hg-relink in the source tarball can be used for the same purpose.


RelinkExtension (last edited 2012-11-06 13:01:14 by abuehl)