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.

Junio C Hamano committed Jun 29, 2026 at 09:28 UTC 8b4e2f2218b4e9461e36d7e6cc7b68c4765a951f
1 file changed +52
update-from-lore.sh new
+52
@@ -0,0 +1,52 @@
1 +#!/bin/sh
2 +
3 +force=
4 +while case "$#" in 0) break;; esac
5 +do
6 + case "$1" in
7 + -f | --force)
8 + force=force ;;
9 + -*)
10 + echo >&2 "$0: unknown option '$1'"
11 + exit 1 ;;
12 + *)
13 + break ;;
14 + esac
15 + shift
16 +done
17 +
18 +case "$#" in
19 +0) : happy ;;
20 +*) echo >&2 "$0: extra arguments" ;;
21 +esac
22 +
23 +above_master=$(git rev-list --first-parent master.. | wc -l)
24 +above_next=$(git rev-list --first-parent next.. | wc -l)
25 +if test "$above_master" != "$above_next"
26 +then
27 + if test "$force" = force
28 + then
29 + echo >&2 warning: some patches are already in next
30 + else
31 + echo >&2 fatal: some patches are already in next
32 + exit 1
33 + fi
34 +fi
35 +
36 +MID=
37 +OLD=$(git rev-parse HEAD)
38 +git detach || exit
39 +git rev-list HEAD..$OLD |
40 +while read commit
41 +do
42 + git notes --ref=amlog show $commit
43 +done |
44 +sed -n -e '/^Message-Id: /{
45 + s///p
46 + q
47 +}' |
48 +xargs -n1 b4 am -o- -T |
49 +tee ./+b4am.mbx |
50 +git am -s3 && rm -f ./+b4am.mbx &&
51 +
52 +git range-diff --notes=amlog --crea=999 @{-1}...