r17901 - gnucash/branches/2.2/util - [17856] Add shell script to easily back-port commits in git-svn from trunk to other branches.

Andreas Köhler andi5 at cvs.gnucash.org
Sat Feb 14 15:26:54 EST 2009


Author: andi5
Date: 2009-02-14 15:26:54 -0500 (Sat, 14 Feb 2009)
New Revision: 17901
Trac: http://svn.gnucash.org/trac/changeset/17901

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

Original commit by cstim.

Added: gnucash/branches/2.2/util/git-backport.sh
===================================================================
--- gnucash/branches/2.2/util/git-backport.sh	                        (rev 0)
+++ gnucash/branches/2.2/util/git-backport.sh	2009-02-14 20:26:54 UTC (rev 17901)
@@ -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/branches/2.2/util/git-backport.sh
___________________________________________________________________
Name: svn:executable
   + *



More information about the gnucash-changes mailing list