X-Git-Url: http://git.jankratochvil.net/?p=nethome.git;a=blobdiff_plain;f=bin%2Fdashtopatch;h=a70dff1e5753b5b060b8f846817ca59c39e86348;hp=bab4561474805a4f536140e818838f539fc6fb91;hb=f51a7283ffe021d8f9b3bfb14a9cedb37a7d15ca;hpb=3d5999f5278568e0f0d948e626f971359d6de42b;ds=sidebyside diff --git a/bin/dashtopatch b/bin/dashtopatch index bab4561..a70dff1 100755 --- a/bin/dashtopatch +++ b/bin/dashtopatch @@ -1,29 +1,45 @@ #! /bin/sh set -ex -if [ $# != 1 ] || ! echo "$1" | grep -q '-';then +compile=false +if [ "$1" = -c ];then + compile=true + shift +fi +if [ $# != 1 ];then echo >&2 "Syntax: $0 branch-list-delimited-by-dashes" exit 1 fi -base="origin/master" +if [ -f origin ];then + origin="`cat origin`" +else + origin="origin/master" +fi +base=$origin gerrit=true if git branch -D gerrit;then - git checkout origin/master + git checkout $origin git checkout -b gerrit else gerrit=false fi for elem in $(echo "$1"|tr '-' ' ');do - if [ "$base" = "origin/master" ];then + if [ "$base" = $origin ];then next="$elem" else next="$base-$elem" fi git checkout "$next" - git merge "$base" - if [ -e "$next".patch ];then - echo -e '/^--- /,$d\nw'|ed "$next".patch || : + git merge --no-edit "$base" + if $compile;then + make + fi + if [ "$origin" != "master" ];then + if [ -e "$next".patch ];then + echo -e '/^--- /,$d\nw'|ed "$next".patch || : + fi + git diff "$base" "$next" --|diffdecvs >>"$next".patch + git diff -U9999999 --binary "$base" "$next" -- >"$next".Upatch fi - git diff "$base" "$next"|diffdecvs >>"$next".patch if $gerrit;then cp "$next".patch dashtopatch.patch echo -e '/^--- /,$d\nw'|ed dashtopatch.patch