X-Git-Url: http://git.jankratochvil.net/?p=nethome.git;a=blobdiff_plain;f=bin%2Fdashtopatch;h=a70dff1e5753b5b060b8f846817ca59c39e86348;hp=73952a0ad846b363dbe42e2c7435485646a74515;hb=f51a7283ffe021d8f9b3bfb14a9cedb37a7d15ca;hpb=7189c344efe24bcb330556f780b07f87f75368ba diff --git a/bin/dashtopatch b/bin/dashtopatch index 73952a0..a70dff1 100755 --- a/bin/dashtopatch +++ b/bin/dashtopatch @@ -5,20 +5,25 @@ if [ "$1" = -c ];then compile=true shift fi -if [ $# != 1 ] || ! echo "$1" | grep -q '-';then +if [ $# != 1 ];then echo >&2 "Syntax: $0 branch-list-delimited-by-dashes" exit 1 fi -base="gdb/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 gdb/master + git checkout $origin git checkout -b gerrit else gerrit=false fi for elem in $(echo "$1"|tr '-' ' ');do - if [ "$base" = "gdb/master" ];then + if [ "$base" = $origin ];then next="$elem" else next="$base-$elem" @@ -28,10 +33,13 @@ for elem in $(echo "$1"|tr '-' ' ');do if $compile;then make fi - if [ -e "$next".patch ];then - echo -e '/^--- /,$d\nw'|ed "$next".patch || : + 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