helper script to merge changes from trunk to branch

Vadim Zeitlin vadim at wxwidgets.org
Sat Jun 2 15:56:17 PDT 2007


 Hello,

 I'd like to share a trivial script which allows to backport a change in
cvs HEAD to a branch. To use it:

1. commit the changes to HEAD (e.g. "cvs ci f1 f2 f3")
2. change to directory containing the branch files (e.g. ~/src/wx/2.8 here)
3. ensure you have the latest branch sources (i.e. "cvs up")
4. run "cvs_merge_last f1 f2 f3"
5. commit to the branch

 To run the script you need to install VCS Perl module which is available
from CPAN (and as a Debian/Ubuntu package). I didn't test it under Windows
but it helps me a lot under Linux.

 Hope this can be helpful,
VZ
-------------- next part --------------
#!/usr/bin/env perl
###############################################################################
# Purpose: merge changes in the last revision of CVS files to another branch
# Usage:   merge_last <filenames...>
# Author:  Vadim Zeitlin <vadim at wxwindows.org>
# License: BSD (http://opensource.org/licenses/bsd-license.php)
# Created: 2007-03-19
# Version: 0.01
# RCS-Id:  $Id: merge_last.pl,v 1.1 2007-03-19 21:05:34 zeitlin Exp $
###############################################################################

use strict;
use warnings;

die "Usage: $0 <filename...>\n" if $#ARGV == -1;

use VCS;
my $cwd = `pwd`;
chomp $cwd;
foreach my $name (@ARGV) {
    my $f = VCS::File->new("vcs://localhost/VCS::Cvs/" . $cwd . "/" . $name);
    my @v = $f->versions;
    system("cvs up -j" .  $v[-2]->version . " -j" . $v[-1]->version . " $name");
}



More information about the wx-dev mailing list