Tips: Saving local disk space when cloning

Magnus Ihse Bursie magnus.ihse.bursie at oracle.com
Wed Nov 22 09:15:08 UTC 2017


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 http://hg.openjdk.java.net/jdk/jdk jdk


If you have already made a local clone and want to avoid re-downloading 
it, you can make a "lean" clone from your local "fat" clone, and then 
remove the fat clone:

hg --config=format.generaldelta=1 --config=format.aggressivemergedeltas=1 clone --pull jdk-fat jdk-lean


If you want a second lean clone, you can just clone that normally ("hg 
clone jdk-lean jdk-lean2") and benefit from mercurials hard linking 
facilities.

Apparently there were some technical reasons why this could not been 
enabled by default on our hg.openjdk.java.net server. :-( But at least 
you can apply this for yourself, if disk space is a premium.

/Magnus


More information about the jdk-dev mailing list