Cherry pick with records

Ben Lau xbenlau at gmail.com
Wed Feb 7 14:35:17 GMT 2007


On 2/7/07, Martin Pool <mbp at canonical.com> wrote:
> On  7 Feb 2007, Ben Lau <xbenlau at gmail.com> wrote:
> > Hi,
> >
> >       Follow the command for cherry pick from
> > http://bazaar-vcs.org/MergeTracking , it could merge changes from
> > another repository successfully, but it doesn't preserve the original
> > log messages. In case that no conflict is encountered during the merge
> > operation, any method could preserve the log message?
>
> Hi Ben,
>
> There is no method to preserve it at present.  There has been some
> discussion, which I think is described in the wiki, of how we could
> capture that information.  If you're interested in implementing it let
> me know and we can talk about it more on the list.
>
> --
> Martin
>

Hi Martin,

    Thanks for your reply. Unfortunately that I don't know much about
Python programming(planned to learn). What I could contribute now is
only a small bash script for "temporary use". It picks changes and log
messages from another repository then commit locally. It will stop
when any conflicts was found.

e.g.

$ cd repo2
$ bzr-cherry-pick.sh 5 14 ../repo1 # merge changes from revno5 to 14
from repo1 to repo2

The code:

#!/bin/sh

r0=$1
r1=$2
repo=$3

set -e

TEMP=`mktemp`

for ((i=$r0+1;i<=$r1;i++))
do
	let j=$i-1
	bzr log -r $i $repo | sed -e "1,6d" > $TEMP
	bzr merge -r $j..$i $repo
	bzr commit -F $TEMP
done

The code is quite ugly (no error checking) but good enough for my own
works. Hope that it is useful before the function is implemented in
bzr.



More information about the bazaar mailing list