Code

Changes between Version 5 and Version 6 of MercurialBranches


Ignore:
Timestamp:
09/13/10 12:43:03 (4 years ago)
Author:
lukeplant
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MercurialBranches

    v5 v6  
    2828 * Alternatively, use the [http://mercurial.selenic.com/wiki/MqExtension queues] extension to manage long lived patches. 
    2929 * To collapse several commits into a single commit before pushing back to svn, use the [http://mercurial.selenic.com/wiki/HisteditExtension histedit] extension 
    30  * To backport a changeset from trunk, use the [http://mercurial.selenic.com/wiki/TransplantExtension transplant] extension 
     30 * To backport a changeset from trunk, use the [http://mercurial.selenic.com/wiki/TransplantExtension transplant] extension.  Or use this handy script which will generate the commit message for you: 
     31   {{{ 
     32#!sh 
     33#!/bin/bash 
     34 
     35function usage { 
     36    echo "Usage: hg_backport <branch> <hgrevision>"; 
     37} 
     38 
     39if [ $# -ne 2 ] 
     40then 
     41        usage; 
     42        exit 1; 
     43fi 
     44 
     45SHORTBRANCH="$1" 
     46BRANCH="releases/$SHORTBRANCH" 
     47HGREV="$2" 
     48 
     49hg st -a -r -m | grep '' > /dev/null && { echo "Working directory not clean - exiting" > /dev/stderr; exit 1; } 
     50 
     51SVNREV=`hg svn info -r $HGREV | egrep '^Revision' | cut -f 2 -d ' '` 
     52if [ "x$SVNREV" = "x" ] 
     53then 
     54        echo "Can't find svn rev"; 
     55        exit 1; 
     56fi 
     57 
     58echo "Backporting Subversion revision $SVNREV" 
     59hg update $BRANCH || exit 1; 
     60hg transplant $HGREV || exit 1; 
     61# Modify the commit message 
     62hg log -r -1 --template "[$SHORTBRANCH] {desc}\n\nBackport of [$SVNREV] from trunk\n" > hg-commit-message.txt || exit 1 
     63hg rollback > /dev/null || exit 1 
     64hg commit -l hg-commit-message.txt || exit 1 
     65echo "Backport committed." 
     66   }}} 
     67   The command line is like: 
     68   {{{ 
     69#!sh 
     70hg_backport 1.2.X 13643` 
     71}}} 
     72   where 1.2.X is a directory under 'releases/' in the Subversion repo, and 13643 is a hg revision ID.  The change is already committed, but not 'pushed', so you can still rollback if changes need to be made. 
     73