changeset 41928:cae3f7e37623

discovery-helper: use reflink copy if available A reflink copy will copy the files "as usual" but keep using the same data block underneath. This is only supported by "copy on write" file system like btrfs or zfs. This will achieve similar performance that the existing hardlink clone that Mercurial performs with the same initial space saving. However, it will behave better on revlogs start being touch by strip. Instead of duplicating all data in the touched revlogs, only the block actually affected by the strip will be duplicated. This save a lot of space when building many variants of large repositories. The --reflink=always flag make sure the `cp` call fails if reflink copies are not supported. Falling back to local clone.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 10 Mar 2019 19:01:56 +0100
parents a60e9f163595
children 35e29a3aa441
files contrib/perf-utils/discovery-helper.sh
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf-utils/discovery-helper.sh	Sun Mar 10 18:52:22 2019 +0100
+++ b/contrib/perf-utils/discovery-helper.sh	Sun Mar 10 19:01:56 2019 +0100
@@ -91,7 +91,9 @@
         exit 1
     fi
     echo '# cloning'
-    hg clone --noupdate "${repo}" "${dest}"
+    if ! cp --recursive --reflink=always ${repo} ${dest}; then
+        hg clone --noupdate "${repo}" "${dest}"
+    fi
     echo '# stripping' '"'${revset}'"'
     hg -R "${dest}" --config extensions.strip= strip --rev "$revset" --no-backup
 }