changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > infra / scripts/bundle-dir.sh

changeset 229: 989b1b4782dc
parent: 9211d38aca7e
child: 3b735bfbd5f0
author: Richard Westhaver <ellis@rwest.io>
date: Sat, 25 May 2024 23:17:00 -0400
permissions: -rwxr-xr-x
description: scripts update
1 #!/usr/bin/env bash
2 # bundle a tar.zst archive of Mercurial repositories.
3 # must be absolute
4 #WD=/mnt/y/data/packy
5 WD="${2:-/tmp/dist}"
6 OUT=$WD/bundle
7 SRC_PATH=$HOME/dev/comp
8 BUNDLE_NAME="${1:-code}"
9 echo "Bundling $BUNDLE_NAME in $OUT..."
10 
11 rm -rf $OUT/*
12 mkdir -pv $OUT
13 mkdir -pv $WD/vc/{zst,stream}
14 
15 cd $SRC_PATH
16 # Find all mercurial repositories, create bundles and dump them to $OUT dir.
17 for i in $(find . -name ".hg" | cut -c 3-); do
18  echo ""
19  echo "found hg repo: $i"
20  cd $i/..
21  echo "making zstd-v2 bundle..."
22  hg bundle -a -t zstd-v2 $WD/vc/zst/$(basename $(hg root)).hg.zst
23  echo "making none-v2 bundle..."
24  hg bundle -a -t none-v2 $WD/vc/$(basename $(hg root)).hg
25  echo "making stream bundle..."
26  hg debugcreatestreamclonebundle $WD/vc/stream/$(basename $(hg root)).hg.stream
27  echo "... Done."
28  cd $SRC_PATH
29 done
30 
31 # archive all *.hg bundles, final compression with zst
32 cd $WD/vc && tar -I 'zstd' -cf $OUT/$BUNDLE_NAME.tar.zst *.hg
33 # tar -cf $OUT/$BUNDLE_NAME.tar.stream vc/stream/*.hg.stream
34 # tar -cf $OUT/$BUNDLE_NAME.tar vc/*.hg
35 echo "Done."