From cd81f6a2bac7bdd34f7c6776ad00d4b7ac4bad28 Mon Sep 17 00:00:00 2001 From: hjp Date: Tue, 5 Jul 2016 20:39:43 +0000 Subject: [PATCH] Check out all revisions of a repository (or directory or file) --- svntools/svnallrevs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 svntools/svnallrevs diff --git a/svntools/svnallrevs b/svntools/svnallrevs new file mode 100755 index 0000000..ce6b616 --- /dev/null +++ b/svntools/svnallrevs @@ -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