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:

[extensions]
relink =
# optionally specify the origin, if you do this a lot:
[paths]
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.


CategoryBundledExtension

RelinkExtension (last edited 2020-05-30 04:17:27 by aayjaychan)