[Libreoffice-commits] dev-tools.git: scripts/git-cherry-gerrit

Miklos Vajna vmiklos at collabora.co.uk
Fri Jul 13 13:33:04 UTC 2018


 scripts/git-cherry-gerrit |   34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

New commits:
commit 095ec09ad0a7c77e2e7acf292cdb695dc9d55479
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Jul 13 15:31:25 2018 +0200

    scripts: add a git-cherry variant that knows about change-ids
    
    Example usage: git-cherry-gerrit collabora cp-5.3 cp-6.0
    
    Change-Id: If5580cc3a1f22189df12b7108fb54db5a90eed6c

diff --git a/scripts/git-cherry-gerrit b/scripts/git-cherry-gerrit
new file mode 100755
index 0000000..033ca33
--- /dev/null
+++ b/scripts/git-cherry-gerrit
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# 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}
+
+: > /tmp/newchanges
+newhashes=$(git rev-list ${old}-branch-point..origin/distro/${vendor}/${new})
+for hash in ${newhashes}
+do
+        git cat-file commit $hash |grep Change-Id: >> /tmp/newchanges
+done
+
+oldhashes=$(git rev-list ${old}-branch-point..origin/distro/${vendor}/${old})
+for hash in ${oldhashes}
+do
+        if ! grep -q "$(git cat-file commit $hash |grep Change-Id:)" /tmp/newchanges; then
+                git log -1 --pretty=oneline $hash
+        fi
+done
+
+rm -f /tmp/newchanges
+
+# vim:set shiftwidth=4 softtabstop=4 expandtab:


More information about the Libreoffice-commits mailing list