this is broken too
#! /usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
=head1 NAME
svn-outdate.pl - svn dump/load cycle to exclude specified revisions
=head1 SYNOPSIS
cd working_copy
# list revisions to omit; here, it's all before 2003 for that file
svn log -r '1:{2002-12-31}' -q trim_me.txt | grep -E '^r'
# trim_me.txt shall exist from r650 onwards
svn-outdate.pl -s /repos/myrepos -d /dev/shm/myrepos.new -N '--fs-type fsfs' /trunk/foo/trim_me.txt 650
# hope for the best - see BUGS!
mv /dev/shm/myrepos.new /repos/
mv /repos/myrepos{,~}
mv /repos/myrepos{.new,}
=head1 DESCRIPTION
Writes to STDOUT a shell script to...
Dump out deltas for all revisions except the ones listed, and load
them into a new repository.
=head2 Details and explanation
Writes "set -e" to the shell script, to bomb out on error. Includes
attempting to create a repository where there is one already.
All the "svnadmin dump" commands run with "--incremental" because we
start from the top (empty repository assumed) and collect deltas
except the unwanted ones.
Not using --deltas on the dump because I haven't looked up what it
does.
=head1 BUGS
Due to the dumping of script to stdout instead of running commands
immediately, there are shell quoting problems, particularly failure to
handle whitespace in repository pathnames.
This is only a proof of concept script, written to prove to myself
that switching from CVS to SVN isn't going to lose me the only feature
of CVS I like that SVN doesn't have. My current understanding of
"svnadmin dump" is that it looks like a hammer and I'm going to trying
bashing some stuff with it to see what happens.
=head1 CONCLUSION
This might still not be the way to do it.
=cut
# $Id: svn-outdate.pl,v 1.2 2007/02/21 00:19:47 mca1001 Exp $
our $VSN = (qw$Revision: 1.2 $)[1];
my %opt = (create => "", help => "");
my %optdescr =
('srcrepos|s=s' => "Source repository path.",
'dstrepos|d=s' => "Destination repository path.",
'create|N=s' => "Extra flags to give 'svnadmin create', splits on whitespace",
);
Getopt::Long::Configure('no_ignore_case');
if (Getopt::Long::GetOptions(\%opt, keys %optdescr)) {
$opt{help} = "--help given\n" if $opt{help};
foreach my $k (qw( srcrepos dstrepos )) {
$opt{help} .= "Need $k, must be absolute path\n"
unless defined $opt{$k} && $opt{$k} =~ m{^/};
}
} else {
$opt{help} = "Invalid options";
}
die "Sorry, no help available\n\n$opt{help}" if $opt{help};
my $now = localtime;
print <<HDR;
#! /bin/sh
# Generated by $0 v$VSN at $now
set -e
set -x
svnadmin create $opt{create} $opt{dstrepos}
HDR
my ($path, $rev) = @ARGV;
die "Need args <path> <last_exclude_rev>" unless @ARGV == 2;
my $revplus = $rev+1;
print <<DUMPLOAD;
echo Revs 1 - $rev, exclude $path
svnadmin dump -q -r 1:$rev $opt{srcrepos} | \
svndumpfilter exclude $path | \
svnadmin load --ignore-uuid $opt{dstrepos}
echo First version of $path, in the new history line
svnadmin dump -q -r $rev $opt{srcrepos} | \
svnadmin load --ignore-uuid $opt{dstrepos}
echo Revs $revplus - HEAD, take everything
svnadmin dump -q -r $revplus:HEAD --incremental $opt{srcrepos} | \
svnadmin load --ignore-uuid $opt{dstrepos}
DUMPLOAD
|
Repository owner Powered by ViewCVS 1.0-dev |
ViewCVS and CVS Help |