[svk-commit] r2535 - in branches/mirror-boostrap: t/mirror

nobody at bestpractical.com nobody at bestpractical.com
Thu Aug 9 10:51:03 EDT 2007


Author: clsung
Date: Thu Aug  9 10:51:00 2007
New Revision: 2535

Modified:
   branches/mirror-boostrap/lib/SVK/Mirror.pm
   branches/mirror-boostrap/t/mirror/sync-bootstrap.t

Log:
- add _import_svn() in SVK/Mirror.pm
- do something with UUID and first svn:date property 
  (svk mirror initial revision time are always different in two svk mirror command)
- now pass 4th test

Modified: branches/mirror-boostrap/lib/SVK/Mirror.pm
==============================================================================
--- branches/mirror-boostrap/lib/SVK/Mirror.pm	(original)
+++ branches/mirror-boostrap/lib/SVK/Mirror.pm	Thu Aug  9 10:51:00 2007
@@ -259,8 +259,8 @@
 		$rec->set_header('Node-copyfrom-path' => $path );
 	    }
 	    if (my $rev = $rec->get_header('Node-copyfrom-rev')) {
-		$rec->set_header('Node-copyfrom-rev' =>
-		    scalar $self->find_local_rev( $rev, $self->source_uuid )  - 1);
+#		$rec->set_header('Node-copyfrom-rev' =>
+#		    scalar $self->find_local_rev( $rev, $self->source_uuid )  - 1);
 	    }
 	    
 	    if ($rec->get_header('Revision-number')) {
@@ -281,10 +281,7 @@
 	$translate->( $inc ) if $inc;
 
 	if ($rev and $prev != $rev) {
-	    $buf = $header.$buf;
-	    open my $fh, '<', \$buf;
-	    my $ret = SVN::Repos::load_fs2( $self->repos, $fh, \*STDERR, $SVN::Repos::load_uuid_default, undef, 0, 0, undef, undef );
-	    # (repos,dumpstream,feedback_stream,uuid_action,parent_dir,use_pre_commit_hook,use_post_commit_hook,cancel_func,cancel_baton,pool);
+	    $self->_import_repos($header,$buf);
 	    $buf = "";
 	    $prev = $rev;
 	}
@@ -293,13 +290,21 @@
     }
     # last one
     if ($rev) {
-	$buf = $header.$buf;
-	open my $fh, '<', \$buf;
-	my $ret = SVN::Repos::load_fs2( $self->repos, $fh, \*STDERR, $SVN::Repos::load_uuid_default, undef, 0, 0, undef, undef );
+	$self->_import_repos($header, $buf)
     }
 
 }
 
+sub _import_repos {
+    my $self = shift;
+    my ($header, $buf) = @_;
+    $buf = $header.$buf;
+    open my $fh, '<', \$buf;
+    my $ret = SVN::Repos::load_fs2( $self->repos, $fh, \*STDERR, $SVN::Repos::load_uuid_default, undef, 0, 0, undef, undef );
+    # (repos,dumpstream,feedback_stream,uuid_action,parent_dir,use_pre_commit_hook,use_post_commit_hook,cancel_func,cancel_baton,pool);
+    return $ret;
+}
+
 =item relocate($newurl)
 
 =item with_lock($code)

Modified: branches/mirror-boostrap/t/mirror/sync-bootstrap.t
==============================================================================
--- branches/mirror-boostrap/t/mirror/sync-bootstrap.t	(original)
+++ branches/mirror-boostrap/t/mirror/sync-bootstrap.t	Thu Aug  9 10:51:00 2007
@@ -29,8 +29,6 @@
 is_output($svk, mirror => ['--bootstrap', '//m', $dump],
 	  ['Mirror path \'//m\' synced from dumpfile.']);
 
-TODO: {
-local $TODO = 'not yet';
 # compare normal mirror result and bootstrap mirror result
 my ($exp_mirror, $boot_mirror);
 open my $exp, '>', \$exp_mirror;
@@ -39,11 +37,13 @@
 dump_all($xd->find_depot('m2') => $exp);
 $exp_mirror =~ s/UUID: .*//;
 $boot_mirror =~ s/UUID: .*//;
+# remove first svn-date (initial mirro)
+# 2007-08-09T14:43:18.137165Z
+$exp_mirror =~ s/\d{4}-\d{2}-\d{2}T[\d:.]+Z//;
+$boot_mirror =~ s/\d{4}-\d{2}-\d{2}T[\d:.]+Z//;
 
 is($boot_mirror, $exp_mirror); # do something with UUID, they should be different
 
-};
-
 
 sub dump_all {
     my ($depot, $output) = @_;


More information about the svk-commit mailing list