update-from-lore: automate updating from mailing list

When on branch T, detach the HEAD at the base of the branch, and
find the newest iteration of the same topic from lore, apply the
patches, and show the range-diff from what we have.

Depends on having healty "amlog" notes to allow us identify what
patch message resulted in the commit T, and working "b4 am" and the
lore archive that lets us grab the latest iteration.
todo
Junio C Hamano 2026-06-29 09:28:18 -07:00
parent ca61a38eca
commit 8b4e2f2218
1 changed files with 52 additions and 0 deletions

52
update-from-lore.sh Executable file
View File

@ -0,0 +1,52 @@
#!/bin/sh

force=
while case "$#" in 0) break;; esac
do
case "$1" in
-f | --force)
force=force ;;
-*)
echo >&2 "$0: unknown option '$1'"
exit 1 ;;
*)
break ;;
esac
shift
done

case "$#" in
0) : happy ;;
*) echo >&2 "$0: extra arguments" ;;
esac

above_master=$(git rev-list --first-parent master.. | wc -l)
above_next=$(git rev-list --first-parent next.. | wc -l)
if test "$above_master" != "$above_next"
then
if test "$force" = force
then
echo >&2 warning: some patches are already in next
else
echo >&2 fatal: some patches are already in next
exit 1
fi
fi

MID=
OLD=$(git rev-parse HEAD)
git detach || exit
git rev-list HEAD..$OLD |
while read commit
do
git notes --ref=amlog show $commit
done |
sed -n -e '/^Message-Id: /{
s///p
q
}' |
xargs -n1 b4 am -o- -T |
tee ./+b4am.mbx |
git am -s3 && rm -f ./+b4am.mbx &&

git range-diff --notes=amlog --crea=999 @{-1}...