[svk-commit] r2295 - trunk/utils

nobody at bestpractical.com nobody at bestpractical.com
Thu Jan 25 22:30:46 EST 2007


Author: clkao
Date: Thu Jan 25 22:30:45 2007
New Revision: 2295

Modified:
   trunk/utils/verify-mirror

Log:
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.


Modified: trunk/utils/verify-mirror
==============================================================================
--- trunk/utils/verify-mirror	(original)
+++ trunk/utils/verify-mirror	Thu Jan 25 22:30:45 2007
@@ -1,5 +1,5 @@
 #!/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;
@@ -25,6 +25,7 @@
 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,
@@ -32,6 +33,15 @@
     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 );
@@ -58,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 => uri_escape( $m->url . ( $parent eq '/' ? '' : $parent ), '^A-Za-z0-9\-_.!~*\'():/' ) );
-
-                # 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);
-            }
+
+}
 
         }
     } );
@@ -101,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