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
+52
new file mode 100755 index 0000000000..73b24fd286 --- /dev/null +++ b/update-from-lore.sh @@ -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}...