changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > infra / scripts/bundle-dir.sh

changeset 15: 17a70918610c
child: 87dd4724adfb
author: ellis <ellis@rwest.io>
date: Mon, 27 Nov 2023 22:33:13 -0500
permissions: -rwxr-xr-x
description: scripts
1 #!/bin/bash
2 # bundle a tar.zst archive of Mercurial repositories.
3 #WD=/mnt/y/data/packy
4 WD=$(realpath dist)
5 OUT=$WD/bundle/src
6 SRC_PATH=$HOME/dev/comp
7 BUNDLE_NAME="${1:-comp}"
8 echo "Bundling $BUNDLE_NAME in $OUT..."
9 
10 rm -rf $OUT/*
11 rm -rf $WD/$BUNDLE_NAME.*
12 mkdir -pv $WD/vc/{zst,stream}
13 
14 pushd $SRC_PATH
15 # Find all mercurial repositories, create bundles and dump them to $OUT dir
16 for i in $(find . -name ".hg" | cut -c 3-); do
17  echo "";
18  echo $i;
19 
20  cd "$i";
21  cd ..;
22  hg bundle -a -t zstd-v2 $WD/vc/zst/$(basename $(hg root)).hg.zst;
23  hg bundle -a -t none-v2 $WD/vc/$(basename $(hg root)).hg;
24  hg debugcreatestreamclonebundle $WD/vc/$(basename $(hg root)).hg.stream;
25  echo "... Done.";
26  cd $SRC_PATH
27 done
28 popd
29 pushd $WD
30 tar -I 'zstd' -cf $OUT/$BUNDLE_NAME.tar.zst vc/zst/*.hg.zst
31 # tar -cf $OUT/$BUNDLE_NAME.tar.stream vc/stream/*.hg.stream
32 # tar -cf $OUT/$BUNDLE_NAME.tar vc/*.hg
33 echo "Done."
34 popd