[Bps-public-commit] r11540 - in SVN-PropDB/lib/Prophet: .

clkao at bestpractical.com clkao at bestpractical.com
Sat Apr 5 17:32:03 EDT 2008


Author: clkao
Date: Sat Apr  5 17:32:00 2008
New Revision: 11540

Modified:
   SVN-PropDB/lib/Prophet/CLI.pm
   SVN-PropDB/lib/Prophet/Replica.pm
   SVN-PropDB/lib/Prophet/Replica/RT.pm

Log:
RT now uses CLI->get_handle_for_replica for state storage.


Modified: SVN-PropDB/lib/Prophet/CLI.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/CLI.pm	(original)
+++ SVN-PropDB/lib/Prophet/CLI.pm	Sat Apr  5 17:32:00 2008
@@ -35,6 +35,10 @@
     return $self->_handle();
 }
 
+=head2 hesdb_handle
+
+=cut
+
 sub resdb_handle {
     my $self = shift;
     unless ( $self->_resdb_handle ) {
@@ -44,6 +48,19 @@
     return $self->_resdb_handle();
 }
 
+
+=head2 get_handle_for_replica($replica, $db_root)
+
+for a foreign $replica, this returns a Prophet::Handle for local storage that are based in db_root
+
+=cut
+
+sub get_handle_for_replica {
+    my ($self, $replica, $db_root) = @_;
+    my $root = $ENV{'PROPHET_REPO'} || dir( $ENV{'HOME'}, '.prophet' ).'/_prophet_replica/'.$replica->uuid;
+    return Prophet::Handle->new( repository => $root, db_root => $db_root );
+}
+
 =head2 _record_cmd
 
 handles the subcommand for a particular type

Modified: SVN-PropDB/lib/Prophet/Replica.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Replica.pm	(original)
+++ SVN-PropDB/lib/Prophet/Replica.pm	Sat Apr  5 17:32:00 2008
@@ -101,6 +101,7 @@
     my $source = $args{'from'};
 
     return unless $self->ressource;
+    return unless $source->ressource;
 
     $self->ressource->import_changesets(
         from     => $source->ressource,

Modified: SVN-PropDB/lib/Prophet/Replica/RT.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Replica/RT.pm	(original)
+++ SVN-PropDB/lib/Prophet/Replica/RT.pm	Sat Apr  5 17:32:00 2008
@@ -109,15 +109,9 @@
         print "\n";
     }
     $self->rt->login( username => $username, password => $password );
-    my $orz = tempdir();
-    $self->{___Orz} = $orz;
-    SVN::Repos::create( $orz, undef, undef, undef, undef );
-    $self->ressource( __PACKAGE__->new( { url => "file://$orz", is_resdb => 1 } ) );
-    
-    warn "WE NEED A STATE HANDLE FOR REAL";
+
     my $cli = Prophet::CLI->new();
-    $self->state_handle($cli->_handle);
-    
+    $self->state_handle( $cli->get_handle_for_replica( $self, 'state' ) );
 }
 
 



More information about the Bps-public-commit mailing list