new script to automate inter-branch merges
This commit is contained in:
parent
1c176d6398
commit
aa40a81c09
1 changed files with 57 additions and 0 deletions
57
utils/cvsmerge
Executable file
57
utils/cvsmerge
Executable file
|
@ -0,0 +1,57 @@
|
|||
#! /usr/bin/perl -w
|
||||
|
||||
# Script to automate the incremental merge operation of a branch into
|
||||
# current cvs workdir, taking into account binary files while still
|
||||
# avoiding spurious conflicts due to the use of RCS keyword in source
|
||||
# files.
|
||||
|
||||
# Example of use:
|
||||
# - initial merge on the 1st syncpoint of a series:
|
||||
# utils/cvsmerge syncpoint_gettext1_1
|
||||
# - incremental merge of changes between 7th and 8th syncpoints:
|
||||
# utils/cvsmerge syncpoint_gettext1_8
|
||||
|
||||
use strict;
|
||||
|
||||
## parameters
|
||||
|
||||
# this may need adjustments as the source tree evolves
|
||||
our @binarydirs = qw(fonts icons images music sounds);
|
||||
our @excludeddirs = qw(. .. CVS);
|
||||
|
||||
## infer non-binary dirs
|
||||
|
||||
our @nonbindirs;
|
||||
{
|
||||
opendir TOP, '.' or die "cannot open top-level dir";
|
||||
my @direntries = readdir TOP or die "cannot read top-level dir";
|
||||
close TOP;
|
||||
|
||||
foreach my $entry (@direntries) {
|
||||
push @nonbindirs, $entry
|
||||
if -d $entry and ! grep { $entry eq $_ } (@binarydirs,@excludeddirs);
|
||||
}
|
||||
}
|
||||
|
||||
## parse command line
|
||||
|
||||
die "must give only a syncpoint tag as argument"
|
||||
unless @ARGV == 1 and $ARGV[0] =~ m/^(syncpoint_.*_)(\d+)$/;
|
||||
|
||||
our ($basetag, $target) = ($1, $2);
|
||||
|
||||
## base of the command
|
||||
|
||||
our $basecmd = 'cvs -f upd -dP ';
|
||||
$basecmd .= '-j syncpoint_gettext1_' . ($target-1) . ' ' if $target > 1;
|
||||
$basecmd .= '-j syncpoint_gettext1_' . $target . ' ';
|
||||
|
||||
## do merge
|
||||
|
||||
foreach my $cmd ($basecmd . '-kk -l',
|
||||
$basecmd . join (' ', @binarydirs),
|
||||
$basecmd . '-kk ' . join (' ', @nonbindirs),
|
||||
) {
|
||||
print "** Now running $cmd\n";
|
||||
system ($cmd) and die "partial merge failed: $!";
|
||||
}
|
Loading…
Add table
Reference in a new issue