changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > infra / scripts/bundle-packy.sh

changeset 279: 91b552d64438
parent: a2313c7003d4
child: 98c3d10d16df
author: Richard Westhaver <ellis@rwest.io>
date: Mon, 17 Jun 2024 01:59:21 +0000
permissions: -rwxr-xr-x
description: bundle updates
1 #!/usr/bin/env bash
2 # bundle a tar.zst archive of git repositories.
3 # must be absolute
4 BUNDLE="${1:-packy}"
5 WD=$(realpath .stash)
6 OUT=$WD
7 SRC_PATH=$HOME/src/$BUNDLE
8 
9 echo "Bundling $BUNDLE_NAME in $OUT..."
10 
11 mkdir -pv $OUT
12 mkdir -pv $WD/src/packy
13 
14 cd $SRC_PATH
15 # Find all git repositories, create bundles and dump them to $OUT dir.
16 for i in $(find . -name ".git" | cut -c 3-); do
17  echo ""
18  echo "found git repo: $i"
19  cd $i/..
20  echo "making git bundle..."
21  git bundle create $WD/src/packy/$(basename $(realpath .)).git --all
22  echo "... Done."
23  cd $SRC_PATH
24 done
25 
26 for i in $(find . -name ".hg" | cut -c 3-); do
27  echo ""
28  echo "found hg repo: $i"
29  cd $i/..
30  echo "making none-v2 bundle..."
31  hg bundle -a -t none-v2 $WD/src/packy/$(basename $(hg root)).hg
32  echo "... Done."
33  cd $SRC_PATH
34 done
35 
36 # archive all *.git bundles and Mercurial .hg bundle
37 cd $WD/src && tar -I 'zstd' -cf $OUT/$BUNDLE.tar.zst packy/*
38 echo "Done."