ossp-pkg/cvsfusion/00BRAINSTORM
##
## cvsfusion [-R/path/to/rcs/bin] [-D/path/to/diff/bin] [-t /tmp] -rOPENPKG:1.1.42 -dopenpkg-src -dopenpkg-re /path/to/vendor/cvs /path/to/local/cvs
##
foreach dir in -d {
foreach file in $vendorcvsroot/$dir {
# remove old attachment
if (exists $localcvsroot/$file) {
cp $localcvsroot/$file $localcvsroot/$file.new
rcs -obranch:: $localcvsroot/$file.new
}
else {
create $localcvsroot/Attic/$file.new (dead, 1.1, /dev/null)
}
# load both into internal structure
load $localcvsroot/$file.new
load $vendorcvsroot/$dir/$file
# turn trunk into regular branch
$prev = -1;
$curr = admin->head();
while (no more $curr) {
getrev($curr, /tmp/curr); # co
$prev = $curr->next();
if (exists $prev) {
getrev($prev, /tmp/prev); # co
}
else {
my $localhead = local->head();
getrev($localhead, /tmp/prev); # co
}
$newdiff = `diff -n /tmp/prev /tmp/curr`;
store($curr, $newdiff);
system("cp /tmp/prev /tmp/curr");
$curr = $prev;
}
# prefix revisions with branch number
# merge target into local structures
# store local structures onto filesystem
}
}
# apply a translation function onto all RCS revisions
sub revapply ($$) {
my ($self, $sub) = @_;
foreach my $num (keys(%{$self->{'rcs'}->{'rev'}})) {
$self->{'rcs'}->{'rev'}->{$num} =
&$sub($self->{'rcs'}->{'rev'}->{$num});
}
return;
}
# get and/or set paths to external tools
sub tool ($;$) {
my ($self, $tool, $path) = @_;
my $old = $self->{'tool'}->{$tool};
if (not defined($old)) {
croak "tool \"$tool\" not known";
}
if (defined($path)) {
$self->{'tool'}->{$tool} = $path;
}
return $old;
}