[svk-commit] r2326 - branches/2.0-releng/utils
nobody at bestpractical.com
nobody at bestpractical.com
Wed Mar 14 19:55:21 EDT 2007
Author: clkao
Date: Wed Mar 14 19:55:21 2007
New Revision: 2326
Modified:
branches/2.0-releng/utils/verify-mirror
Log:
Merge from trunk:
r2292 at trunk: clkao | 2007-01-19 05:09:21 +0000
Escape uri for verify-mirror.
r2295 at trunk: clkao | 2007-01-26 03:30:45 +0000
Update verify-mirror to make use of replay. This requires 1.4.3
on the server, as the checksum of files aren't previously conveyed.
r2317 at trunk: clkao | 2007-03-08 16:41:05 +0000
Fix verify-mirror on mirrors of subdir of remote repositories.
Modified: branches/2.0-releng/utils/verify-mirror
==============================================================================
--- branches/2.0-releng/utils/verify-mirror (original)
+++ branches/2.0-releng/utils/verify-mirror Wed Mar 14 19:55:21 2007
@@ -1,11 +1,13 @@
#!/usr/bin/perl -w
-# XXX: This requires newer svn api do make do_status work
+# NOTE: This requires subversion 1.4.3 on both client and server
# usage: verify-mirror repospath path revision
use strict;
no warnings 'once';
use SVK;
use SVK::XD;
+use SVK::Util 'abs2rel';
+use URI::Escape 'uri_escape';
my ($repospath, $path, $revision) = @ARGV;
@@ -24,16 +26,25 @@
my $changed = $t->root->paths_changed;
my $rev = $m->find_changeset($t->revision) or die "Can't find remote revision for ".$t->revision;
my $ra = $rabackend->_new_ra;
-
+my $md5;
require SVK::Command::Log;
$ra->get_log([''], $rev, $rev, 0,
1, 1,
sub {
my ( $paths, $r, $author, $date, $log, $ppool ) = @_;
my $pool = SVN::Pool->new($ppool);
+
+ my $fra = $rabackend->_new_ra;
+ my $editor = MD5Collect::Editor->new(
+ cb_md5 => sub { $md5->{ $_[0] } = $_[1] },
+ );
+ $fra->replay( $rev, 0, 0, $editor );
+ $rabackend->_ra_finished($fra);
+
+
for my $remotepath ( sort keys %$paths ) {
$pool->clear;
- my $localpath = Path::Class::Dir->new_foreign('Unix', $path)->subdir( $remotepath );
+ my $localpath = abs2rel($remotepath, $m->source_path => $path, '/');
my $local = delete $changed->{$localpath}
or die "$localpath is not in changes";
my $action = $SVK::Command::Log::chg->[ $local->change_kind ];
@@ -57,41 +68,16 @@
}
if ( $t->root->check_path($localpath) == $SVN::Node::file ) {
- my $p = Path::Class::File->new_foreign( 'Unix', $remotepath );
- my ( $parent, $target ) = ( $p->parent, $p->basename );
-
- # do md5 comparison
- my $fra = $rabackend->_new_ra(
- url => $m->url . ( $parent eq '/' ? '' : $parent ) );
-
- # XXX: do_status requires svn trunk, and the required
- # changed should be merged to 1.4.3
- my $md5;
- my $reporter = $fra->do_status(
- "$target",
- $rev, 1,
- MD5Collect::Editor->new(
- cb_md5 => sub { $md5->{ $_[0] } = $_[1] },
-# _debug => 1
-# }
- )
- );
-
- # my $reporter = $fra->do_update( $rev, "$target", 0,
- # SVK::Editor->new( { _debug => 1 } ) );
- $reporter->set_path( '', $rev - 1, 0, undef );
- # $reporter->set_path( $target, $rev-1, 1, '' );
- $reporter->finish_report;
-
- $rabackend->_ra_finished($fra);
-
- die "no md5 found from server for $remotepath ($target)"
- unless $md5->{$target};
+ my $entry = $remotepath;
+ $entry =~ s|^/||;
+ my $exp_md5 = delete $md5->{$entry}
+ or die "no md5 found from server for $remotepath";
die "md5 for $localpath is different"
- unless $md5->{$target} eq
+ unless $exp_md5 eq
$t->root->file_md5_checksum($localpath);
- }
+
+}
}
} );
@@ -100,6 +86,9 @@
die "not in remote: ".join(',', keys %$changed)
if keys %$changed;
+die "md5 not verified: ".join(',', keys %$md5)
+ if keys %$md5;
+
package MD5Collect::Editor;
use base 'SVK::Editor';
__PACKAGE__->mk_accessors(qw(cb_md5));
More information about the svk-commit
mailing list