r17856 - gnucash/trunk/util - Add shell script to easily back-port commits in git-svn from trunk to other branches.

Christian Stimming cstim at cvs.gnucash.org
Sat Jan 31 05:24:34 EST 2009


Author: cstim
Date: 2009-01-31 05:24:34 -0500 (Sat, 31 Jan 2009)
New Revision: 17856
Trac: http://svn.gnucash.org/trac/changeset/17856

Added:
   gnucash/trunk/util/git-backport.sh
Log:
Add shell script to easily back-port commits in git-svn from trunk to other branches.

Added: gnucash/trunk/util/git-backport.sh
===================================================================
--- gnucash/trunk/util/git-backport.sh	                        (rev 0)
+++ gnucash/trunk/util/git-backport.sh	2009-01-31 10:24:34 UTC (rev 17856)
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+REV=$1
+: ${ORIGBRANCH=trunk}
+: ${WHOAMI=`whoami`}
+
+TMPFILE=tmplog.tmp
+#TMPFILE2=tmplog2.tmp
+
+# Cherry-pick the other commit
+ORIGID=`git svn find-rev r${REV} ${ORIGBRANCH}`
+if [ -z "${ORIGID}" ] ; then
+    echo "Revision ${REV} not found in branch ${ORIGBRANCH}"
+    exit 1
+fi
+git cherry-pick ${ORIGID}
+
+# Create new log message by modifying the old one
+git log --pretty=format:"[$REV] %s%n%n%b" HEAD^..HEAD \
+    | grep -v '^BP$' | grep -v 'git-svn-id:' > ${TMPFILE}
+OTHERAUTHOR=`git log --pretty=format:"%an" HEAD^..HEAD`
+if [ "${WHOAMI}" != "${OTHERAUTHOR}" ]; then
+    echo -e "\nOriginal commit by ${OTHERAUTHOR}." >> ${TMPFILE}
+fi
+
+# Commit new log message
+git commit --amend -F ${TMPFILE}
+
+# Clean up temporary files
+rm -f ${TMPFILE}


Property changes on: gnucash/trunk/util/git-backport.sh
___________________________________________________________________
Name: svn:executable
   + *



More information about the gnucash-changes mailing list