git://git.jankratochvil.net
/
nethome.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
master->origin/master
[nethome.git]
/
bin
/
dashtopatch
diff --git
a/bin/dashtopatch
b/bin/dashtopatch
index
fb3d4fd
..
bab4561
100755
(executable)
--- a/
bin/dashtopatch
+++ b/
bin/dashtopatch
@@
-1,34
+1,38
@@
#! /bin/sh
set -ex
#! /bin/sh
set -ex
-if [ "$1" = "-f" ];then
- force=true
- shift
-elif [ -n "$(/bin/ls *.patch 2>/dev/null|tee /proc/self/fd/2)" ];then
- echo >&2 "Some *.patch files exist!"
- exit 1
-else
- force=false
-fi
if [ $# != 1 ] || ! echo "$1" | grep -q '-';then
echo >&2 "Syntax: $0 branch-list-delimited-by-dashes"
exit 1
fi
if [ $# != 1 ] || ! echo "$1" | grep -q '-';then
echo >&2 "Syntax: $0 branch-list-delimited-by-dashes"
exit 1
fi
-base="master"
+base="origin/master"
+gerrit=true
+if git branch -D gerrit;then
+ git checkout origin/master
+ git checkout -b gerrit
+else
+ gerrit=false
+fi
for elem in $(echo "$1"|tr '-' ' ');do
for elem in $(echo "$1"|tr '-' ' ');do
- if [ "$base" = "master" ];then
+ if [ "$base" = "
origin/
master" ];then
next="$elem"
else
next="$base-$elem"
fi
git checkout "$next"
git merge "$base"
next="$elem"
else
next="$base-$elem"
fi
git checkout "$next"
git merge "$base"
- if $force;then
- echo -e '/^--- /,$d\nw'|ed "$next".patch
- else
- rm -f "$next".patch
+ if [ -e "$next".patch ];then
+ echo -e '/^--- /,$d\nw'|ed "$next".patch || :
fi
git diff "$base" "$next"|diffdecvs >>"$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
base="$next"
done
-git checkout
master
+git checkout
"$next"
echo OK
echo OK