Tips: Saving local disk space when cloning

Aleksey Shipilev ashipile at
Wed Nov 22 14:48:04 UTC 2017

On 11/22/2017 10:15 AM, Magnus Ihse Bursie wrote:
> I'd like to propagate a tips I got from Erik. If you have a recent enough mercurial, you can save
> some significant local disk space by applying Mercurials "aggressive merge" algorithm when cloning.
> This brings down the .hg directory from 1.6 GB to 1.1 GB. While disk is cheap these days, SSD:s on
> laptops are still quite limited (at least mine is!), and if you have multiple repos cloned, these
> gigabytes add up. The only downside is that the conversion takes quite some time (~1 hour).
> To achieve this, use the following command line when cloning:
> hg --config=format.generaldelta=1 --config=format.aggressivemergedeltas=1 clone --pull
> jdk
> Apparently there were some technical reasons why this could not been enabled by default on our
> server. :-( But at least you can apply this for yourself, if disk space is a
> premium.

Very nice trick, thanks! You can do the same with pre-jdk10 builds, with:

 $ HGFOREST_GLOBALOPTS=" --config=format.generaldelta=1 --config=format.aggressivemergedeltas=1" \
     sh common/bin/ clone

This cuts down both workspace and compressed tarball sizes quite significantly. E.g. workspace
tarballs at are now 50-300 MB lighter.


More information about the jdk-dev mailing list