X-Git-Url: https://git.jankratochvil.net/?p=nethome.git;a=blobdiff_plain;f=bin%2Fdashtopatch;h=717c5cc275a632f398b5ca4b2d824af350310124;hp=3661ccf66426c6fcbfae8166d405995f831596d3;hb=8104eca7d9cf4376bfa2eddc3c2a71b84b9d9d02;hpb=575d057c2c709a4ac4743380ea5223ab48a2e147 diff --git a/bin/dashtopatch b/bin/dashtopatch index 3661ccf..717c5cc 100755 --- a/bin/dashtopatch +++ b/bin/dashtopatch @@ -1,22 +1,51 @@ #! /bin/sh set -ex +compile=false +if [ "$1" = -c ];then + compile=true + shift +fi if [ $# != 1 ] || ! echo "$1" | grep -q '-';then echo >&2 "Syntax: $0 branch-list-delimited-by-dashes" exit 1 fi -base="master" +if [ -f origin ];then + origin="`cat origin`" +else + origin="gdb/master" +fi +base=$origin +gerrit=true +if git branch -D gerrit;then + git checkout $origin + git checkout -b gerrit +else + gerrit=false +fi for elem in $(echo "$1"|tr '-' ' ');do - if [ "$base" = "master" ];then + if [ "$base" = $origin ];then next="$elem" else next="$base-$elem" fi git checkout "$next" - git merge "$base" + git merge --no-edit "$base" + if $compile;then + make + fi if [ -e "$next".patch ];then - echo -e '/^--- /,$d\nw'|ed "$next".patch + echo -e '/^--- /,$d\nw'|ed "$next".patch || : fi git diff "$base" "$next"|diffdecvs >>"$next".patch + if $gerrit;then + cp "$next".patch dashtopatch.patch + echo -e '/^--- /,$d\nw'|ed dashtopatch.patch + git checkout gerrit + patch -p1 <"$next".patch + git commit -a -F dashtopatch.patch + rm -f dashtopatch.patch + fi base="$next" done +git checkout "$next" echo OK