diff --git a/update-from-lore.sh b/update-from-lore.sh 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}...