[Libreoffice-commits] dev-tools.git: scripts/git-cherry-gerrit
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Oct 5 16:47:46 UTC 2018
scripts/git-cherry-gerrit | 36 +++++++++++++++++++++++-------------
1 file changed, 23 insertions(+), 13 deletions(-)
New commits:
commit 270ef840127cf753de7438b6feb9462a7c9ddbc4
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Oct 5 18:46:13 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Oct 5 18:46:13 2018 +0200
git-cherry-gerrit: Generalize it a bit.
It does not have to be used only on the vendor branches.
Change-Id: I021c4232fcceafd9903c9520bba912546563bd46
diff --git a/scripts/git-cherry-gerrit b/scripts/git-cherry-gerrit
index 98de663..eabf3a7 100755
--- a/scripts/git-cherry-gerrit
+++ b/scripts/git-cherry-gerrit
@@ -7,22 +7,32 @@
# A version of 'git cherry' that works with change-ids, so it can pair patches
# even if their patch id changed.
#
-# Required parameters: vendor, old-branch, new-branch.
-#
-vendor=${1}
-old=${2}
-new=${3}
+cherry_from=${1}
+cherry_to=${2}
+
+branch_point=${3}
+
+if [ -z "$cherry_from" ] ; then
+ echo "Usage: git-cherry-gerrit cherry_from cherry_to [branch_point_from]"
+ exit 1;
+fi
+
+merge_base=$(git merge-base $cherry_from $cherry_to)
+
+if [ -z "$branch_point" ] ; then
+ branch_point=${merge_mase}
+fi
-: > /tmp/newchanges
-newhashes=$(git rev-list ${old}-branch-point..distro/${vendor}/${new})
-for hash in ${newhashes}
+: > /tmp/tohashes
+to_hashes=$(git rev-list ${merge_base}..${cherry_to})
+for hash in ${to_hashes}
do
- git cat-file commit $hash |grep Change-Id: >> /tmp/newchanges
+ git cat-file commit $hash |grep Change-Id: >> /tmp/tohashes
done
-oldhashes=$(git rev-list ${old}-branch-point..logerrit/distro/${vendor}/${old})
-for hash in ${oldhashes}
+from_hashes=$(git rev-list ${branch_point}..${cherry_from})
+for hash in ${from_hashes}
do
changeid="$(git cat-file commit $hash |grep Change-Id:)"
if [ -z "$changeid" ]; then
@@ -30,11 +40,11 @@ do
continue
fi
- if ! grep -q "$changeid" /tmp/newchanges; then
+ if ! grep -q "$changeid" /tmp/tohashes; then
git log -1 --pretty=oneline $hash
fi
done
-rm -f /tmp/newchanges
+rm -f /tmp/tohashes
# vim:set shiftwidth=4 softtabstop=4 expandtab:
More information about the Libreoffice-commits
mailing list