[pacman-dev] [PATCH] makepkg: Pass --stream to `hg clone` when creating the working copy

Luke Shumaker lukeshu at lukeshu.com
Sat Sep 8 20:31:16 UTC 2018

From: Luke Shumaker <lukeshu at parabola.nu>

Without --stream, `hg clone` reencodes+recompresses the entire repository,
to the storage settings of the host.  But download_hg() already did that
on the initial network clone, and it is 100% pointless duplicated work for
the local clone.

The work that this saves is CPU-bound (not disk-bound), and is restricted
to a single core.

The --stream flag has only existed since Mercurial 4.4 (2017-11-01).  Prior
to that, it was named --uncompressed.  --uncompressed still exists as a
compatibility alias for --stream, and marked deprecated, though there is
currently no schedule for its removal.
 scripts/libmakepkg/source/hg.sh.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/libmakepkg/source/hg.sh.in b/scripts/libmakepkg/source/hg.sh.in
index ae9aed3b..7346e1e3 100644
--- a/scripts/libmakepkg/source/hg.sh.in
+++ b/scripts/libmakepkg/source/hg.sh.in
@@ -94,7 +94,7 @@ extract_hg() {
 			plain "$(gettext "Aborting...")"
 			exit 1
-	elif ! hg clone -u "$ref" "$dir" "${dir##*/}"; then
+	elif ! hg clone -u "$ref" --stream "$dir" "${dir##*/}"; then
 		error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "hg"
 		plain "$(gettext "Aborting...")"
 		exit 1

More information about the pacman-dev mailing list