[Bps-public-commit] r11316 - in SVN-PropDB: bin lib/Prophet

clkao at bestpractical.com clkao at bestpractical.com
Mon Mar 31 21:59:09 EDT 2008


Author: clkao
Date: Mon Mar 31 21:59:09 2008
New Revision: 11316

Modified:
   SVN-PropDB/bin/prophet-merge
   SVN-PropDB/lib/Prophet/CLI.pm
   SVN-PropDB/lib/Prophet/Sync/Source/SVN.pm

Log:
create _res db for each prophetdb.

Modified: SVN-PropDB/bin/prophet-merge
==============================================================================
--- SVN-PropDB/bin/prophet-merge	(original)
+++ SVN-PropDB/bin/prophet-merge	Mon Mar 31 21:59:09 2008
@@ -6,6 +6,8 @@
 use Prophet::Sync::Source::SVN;
 use Params::Validate;
 use Getopt::Long;
+use Prophet::CLI;
+Prophet::CLI->new; # to get res handle;
 
 my $opts = {};
 

Modified: SVN-PropDB/lib/Prophet/CLI.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/CLI.pm	(original)
+++ SVN-PropDB/lib/Prophet/CLI.pm	Mon Mar 31 21:59:09 2008
@@ -3,7 +3,7 @@
 
 package Prophet::CLI;
 use base qw/Class::Accessor/;
-__PACKAGE__->mk_accessors(qw/type uuid _handle/);
+__PACKAGE__->mk_accessors(qw/type uuid _handle _resdb_handle/);
 
 use Path::Class;
 use Prophet;
@@ -11,6 +11,12 @@
 use Prophet::Record;
 use Prophet::Collection;
 
+sub new {
+    my $class = shift;
+    my $self = $class->SUPER::new(@_);
+    $self->handle; $self->resdb_handle;
+    return $self;
+}
 
 =head2 handle
 
@@ -20,15 +26,25 @@
 sub handle {
     my $self = shift;
     unless ($self->_handle) {
-    my $root = $ENV{'PROPHET_REPO'} || dir($ENV{'HOME'},'.prophet');
-    my $path = $ENV{'PROPHET_REPO_PATH'} ||'_prophet';
-    $self->_handle( Prophet::Handle->new( repository => $root, db_root => $path ));
-
+        my $root = $ENV{'PROPHET_REPO'} || dir($ENV{'HOME'},'.prophet');
+        my $path = $ENV{'PROPHET_REPO_PATH'} ||'_prophet';
+        $self->_handle( Prophet::Handle->new( repository => $root, db_root => $path ));
     }
     return $self->_handle();
 }
 
 
+sub resdb_handle {
+    my $self = shift;
+    unless ($self->_resdb_handle) {
+        my $root = ($ENV{'PROPHET_REPO'} || dir($ENV{'HOME'},'.prophet'))."_res";
+        my $path = $ENV{'PROPHET_REPO_PATH'} ||'_prophet';
+        $self->_resdb_handle( Prophet::Handle->new( repository => $root, db_root => $path ));
+    }
+    return $self->_resdb_handle();
+}
+
+
 
 =head2 parse_args
 

Modified: SVN-PropDB/lib/Prophet/Sync/Source/SVN.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Sync/Source/SVN.pm	(original)
+++ SVN-PropDB/lib/Prophet/Sync/Source/SVN.pm	Mon Mar 31 21:59:09 2008
@@ -15,7 +15,7 @@
 use Prophet::ChangeSet;
 use Prophet::Conflict;
 
-__PACKAGE__->mk_accessors(qw/url ra prophet_handle/);
+__PACKAGE__->mk_accessors(qw/url ra prophet_handle ressource/);
 
 our $DEBUG = $Prophet::Handle::DEBUG;
 
@@ -31,12 +31,19 @@
     my $self = shift;
     my ( $baton, $ref ) = SVN::Core::auth_open_helper( Prophet::Sync::Source::SVN::Util->get_auth_providers );
     my $config = Prophet::Sync::Source::SVN::Util->svnconfig;
+eval {
     $self->ra( SVN::Ra->new( url => $self->url, config => $config, auth => $baton ));
-
+}; Carp::confess $@ if $@;
     if ( $self->url =~ /^file:\/\/(.*)$/ ) {
         $self->prophet_handle( Prophet::Handle->new( { repository => $1, db_root => '_prophet' }));
     }
+    if ($self->url =~ m/_res$/) {
+        return;
+    }
 
+    my $res_url = $self->url;
+    $res_url =~ s/(\_res|)$/_res/;
+    $self->ressource( __PACKAGE__->new( { url => $res_url } ) );
 }
 
 =head2 uuid
@@ -229,9 +236,6 @@
 
     my $changeset = $args{'changeset'};
 
-
-=begin comment
-
     # when we start to integrate a changeset, we need to do a bit of housekeeping
     # We never want to merge in:
         # merge tickets that describe merges from the local node
@@ -242,10 +246,7 @@
     #   - changes from some other party we've merged from
     #   - merge tickets for the same
     # we'll want to skip or remove those changesets
-        
-        
-=cut    
-    
+
     return if $changeset->original_source_uuid eq $self->prophet_handle->uuid;
     $self->remove_redundant_data($changeset); #Things we have already seen
     return if ($changeset->is_empty or $changeset->is_nullification);



More information about the Bps-public-commit mailing list