X-Git-Url: https://git.jankratochvil.net/?p=nethome.git;a=blobdiff_plain;f=bin%2Fdashtopatch;h=03ae6529a175637629b33acc26af371310c3f157;hp=3661ccf66426c6fcbfae8166d405995f831596d3;hb=f1fd1da97405a124a824d3808d6bc59df1b16b9b;hpb=575d057c2c709a4ac4743380ea5223ab48a2e147 diff --git a/bin/dashtopatch b/bin/dashtopatch index 3661ccf..03ae652 100755 --- a/bin/dashtopatch +++ b/bin/dashtopatch @@ -5,6 +5,13 @@ if [ $# != 1 ] || ! echo "$1" | grep -q '-';then exit 1 fi base="master" +gerrit=true +if git branch -D gerrit;then + git checkout master + git checkout -b gerrit +else + gerrit=false +fi for elem in $(echo "$1"|tr '-' ' ');do if [ "$base" = "master" ];then next="$elem" @@ -14,9 +21,18 @@ for elem in $(echo "$1"|tr '-' ' ');do git checkout "$next" git merge "$base" 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