[svk-commit] r2208 - in branches/2.0-releng/lib/SVK: Mirror/Backend

nobody at bestpractical.com nobody at bestpractical.com
Fri Dec 1 16:19:09 EST 2006


Author: clkao
Date: Fri Dec  1 16:19:09 2006
New Revision: 2208

Modified:
   branches/2.0-releng/lib/SVK/Mirror.pm
   branches/2.0-releng/lib/SVK/Mirror/Backend/SVNRa.pm
   branches/2.0-releng/lib/SVK/Mirror/Backend/SVNSync.pm

Log:
Fix SVK::Mirror::find_changeset, which should belong to the backend.


Modified: branches/2.0-releng/lib/SVK/Mirror.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/Mirror.pm	(original)
+++ branches/2.0-releng/lib/SVK/Mirror.pm	Fri Dec  1 16:19:09 2006
@@ -299,22 +299,6 @@
 
 =cut
 
-sub find_changeset {
-    my ($self, $rev) = @_;
-    return $self->_find_remote_rev($rev, $self->repos);
-}
-
-sub _find_remote_rev {
-    my ($self, $rev, $repos) = @_;
-    $repos ||= $self->repos;
-    my $fs = $repos->fs;
-    my $prop = $fs->revision_prop($rev, 'svm:headrev') or return;
-    my %rev = map {split (':', $_, 2)} $prop =~ m/^.*$/mg;
-    return %rev if wantarray;
-    # XXX: needs to be more specific
-    return $rev{ $self->source_uuid } || $rev{ $self->server_uuid };
-}
-
 =item find_rev_from_changeset($remote_identifier)
 
 =item traverse_new_changesets($code)
@@ -338,11 +322,12 @@
 }
 
 for my $delegate
-    qw( find_rev_from_changeset sync_changeset traverse_new_changesets mirror_changesets get_commit_editor refresh change_rev_prop fromrev source_path relocate )
+    qw( find_rev_from_changeset find_changeset sync_changeset traverse_new_changesets mirror_changesets get_commit_editor refresh change_rev_prop fromrev source_path relocate )
 {
     no strict 'refs';
     *{$delegate} = sub {
         my $self   = shift;
+	Carp::cluck $delegate unless $self->_backend;
         my $method = $self->_backend->can($delegate);
         unshift @_, $self->_backend;
         goto $method;

Modified: branches/2.0-releng/lib/SVK/Mirror/Backend/SVNRa.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/Mirror/Backend/SVNRa.pm	(original)
+++ branches/2.0-releng/lib/SVK/Mirror/Backend/SVNRa.pm	Fri Dec  1 16:19:09 2006
@@ -93,7 +93,7 @@
     my $fs = $self->mirror->repos->fs;
     my $root = $fs->revision_root($fs->youngest_rev);
     my $changed = $root->node_created_rev($self->mirror->path);
-    return scalar $self->mirror->find_changeset($changed);
+    return scalar $self->find_changeset($changed);
 }
 
 sub refresh {
@@ -362,11 +362,32 @@
 	( cmp => sub {
 	      my $rev = shift;
 	      my $search = $t->mclone(revision => $rev);
-              my $s_changeset = scalar $self->mirror->find_changeset($rev);
+              my $s_changeset = scalar $self->find_changeset($rev);
               return $s_changeset <=> $changeset;
           } );
 }
 
+=item find_changeset( $local_rev )
+
+=cut
+
+sub find_changeset {
+    my ($self, $rev) = @_;
+    return $self->_find_remote_rev($rev, $self->mirror->repos);
+}
+
+sub _find_remote_rev {
+    my ($self, $rev, $repos) = @_;
+    $repos ||= $self->mirror->repos;
+    my $fs = $repos->fs;
+    my $prop = $fs->revision_prop($rev, 'svm:headrev') or return;
+    my %rev = map {split (':', $_, 2)} $prop =~ m/^.*$/mg;
+    return %rev if wantarray;
+    # XXX: needs to be more specific
+    return $rev{ $self->mirror->source_uuid } || $rev{ $self->mirror->server_uuid };
+}
+
+
 =item traverse_new_changesets()
 
 =cut

Modified: branches/2.0-releng/lib/SVK/Mirror/Backend/SVNSync.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/Mirror/Backend/SVNSync.pm	(original)
+++ branches/2.0-releng/lib/SVK/Mirror/Backend/SVNSync.pm	Fri Dec  1 16:19:09 2006
@@ -99,7 +99,10 @@
     $self->mirror->depot->reposfs->change_rev_prop( 0, 'svn:svnsync:from-url',  $self->mirror->url );
 }
 
-sub find_rev_from_changeset { $_[0] }
+sub find_rev_from_changeset { $_[1] }
+
+sub find_changeset { $_[1] }
+
 
 sub _revmap_prop { }
 


More information about the svk-commit mailing list