Skip to content

Instantly share code, notes, and snippets.

@arjan
Created February 14, 2011 08:14
Show Gist options
  • Save arjan/825603 to your computer and use it in GitHub Desktop.
Save arjan/825603 to your computer and use it in GitHub Desktop.
Backport latest zotonic commit to the most recent release branch
#!/bin/bash
if [ "`hg branch`" != "default" ]; then
echo "You need to be on the default branch."
exit
fi
REV="`hg parents |grep changeset|awk -F: '{print $2}'`"
REV=`echo $REV` # trim whitespace
TARGET=$1
if [ "$TARGET" = "" ]; then
# take most recent branch
TARGET=`hg branches|grep release|head -n 1|awk '{print $1}'`
fi
echo "Backporting revision $REV to $TARGET"
hg export $REV > /tmp/$REV.patch
hg update $TARGET
hg import /tmp/$REV.patch
hg update default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment