Check out all revisions of a repository (or directory or file)

This commit is contained in:
hjp 2016-07-05 20:39:43 +00:00
parent ce339c38c7
commit cd81f6a2ba
1 changed files with 25 additions and 0 deletions

25
svntools/svnallrevs Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/perl
use warnings;
use strict;
push @ARGV, "." unless (@ARGV);
for my $target (@ARGV) {
open(my $svnlog_fh, '-|', 'svn', 'log', $target) or die "cannot invoke svn log $target: $!";
my $atstart;
while (<$svnlog_fh>) {
if (/^------------------------------------------------------------------------$/) {
$atstart = 1;
next;
}
if ($atstart && /^r(\d+) \| /) {
my $revline = $_;
chomp $revline;
my $revision = $1;
system('svn', 'co', "-r$revision", $target, $revision) == 0 or die "cannot invoke svn co -r$revision $target $revision: $!";
}
$atstart = 0;
}
}
# vim: tw=0