[Bps-public-commit] SD branch, master, updated. 0.74-53-g3d22880

Jesse Vincent jesse at bestpractical.com
Sun Sep 5 21:54:15 EDT 2010


The branch, master has been updated
       via  3d22880f83fff1886deaaf00c8de1a560de12b69 (commit)
      from  737b88ea5eb4dae10d42538040fa312c29a10b7c (commit)

Summary of changes:
 lib/App/SD/ForeignReplica.pm     |   13 +++++++++++++
 lib/App/SD/Replica/gcode.pm      |   16 +++++-----------
 lib/App/SD/Replica/github.pm     |    4 ++--
 lib/App/SD/Replica/hm.pm         |    6 +++---
 lib/App/SD/Replica/lighthouse.pm |    4 ++--
 lib/App/SD/Replica/redmine.pm    |    4 ++--
 lib/App/SD/Replica/rt.pm         |    4 ++--
 lib/App/SD/Replica/trac.pm       |    4 ++--
 8 files changed, 31 insertions(+), 24 deletions(-)

- Log -----------------------------------------------------------------
commit 3d22880f83fff1886deaaf00c8de1a560de12b69
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Sun Sep 5 21:55:38 2010 -0400

    abstract out the ForeignReplica uuid parameter and cache it, since it
    doesn't change but gets called _lots_.

diff --git a/lib/App/SD/ForeignReplica.pm b/lib/App/SD/ForeignReplica.pm
index aa76108..1916d4d 100644
--- a/lib/App/SD/ForeignReplica.pm
+++ b/lib/App/SD/ForeignReplica.pm
@@ -3,6 +3,19 @@ use Any::Moose;
 use Params::Validate qw/:all/;
 
 extends 'Prophet::ForeignReplica';
+
+
+has uuid => (
+    lazy    => 1,
+    isa     => 'Str',
+    is      => 'ro',
+    default => sub {
+        my $self = shift;
+        $self->uuid_for_url( $self->_uuid_url );
+    }
+);
+
+
 sub integrate_changeset {
     my $self = shift;
     my %args = validate(
diff --git a/lib/App/SD/Replica/gcode.pm b/lib/App/SD/Replica/gcode.pm
index d68e9ce..5739ad9 100644
--- a/lib/App/SD/Replica/gcode.pm
+++ b/lib/App/SD/Replica/gcode.pm
@@ -95,17 +95,6 @@ sub get_txn_list_by_date {
     return @txns;
 }
 
-=head2 uuid
-
-Return the replica's UUID
-
-=cut
-
-sub uuid {
-    my $self = shift;
-    return $self->uuid_for_url( $self->remote_url);
-}
-
 sub remote_uri_path_for_comment {
     my $self = shift;
     my $id = shift;
@@ -141,6 +130,11 @@ sub database_settings {
     };
 }
 
+sub _uuid_url {
+    my $self = shift;
+    return $self->remote_url;
+}
+
 __PACKAGE__->meta->make_immutable;
 no Any::Moose;
 
diff --git a/lib/App/SD/Replica/github.pm b/lib/App/SD/Replica/github.pm
index 9e672ad..3e1dd7a 100644
--- a/lib/App/SD/Replica/github.pm
+++ b/lib/App/SD/Replica/github.pm
@@ -86,10 +86,10 @@ sub BUILD {
 
 sub record_pushed_transactions {}
 
-sub uuid {
+sub _uuid_url {
     my $self = shift;
     Carp::cluck "- can't make a uuid for this" unless ($self->remote_url && $self->owner && $self->repo );
-    return $self->uuid_for_url( join( '/', $self->remote_url, $self->owner , $self->repo ) );
+    return join( '/', $self->remote_url, $self->owner , $self->repo ) ;
 }
 
 sub remote_uri_path_for_comment {
diff --git a/lib/App/SD/Replica/hm.pm b/lib/App/SD/Replica/hm.pm
index 20deeae..db605b8 100644
--- a/lib/App/SD/Replica/hm.pm
+++ b/lib/App/SD/Replica/hm.pm
@@ -72,15 +72,15 @@ sub BUILD {
     );
 }
 
-=head2 uuid
+=head2 _uuid_url
 
 Return the replica's UUID
 
 =cut
 
-sub uuid {
+sub _uuid_url {
     my $self = shift;
-    return $self->uuid_for_url( join( '/', $self->remote_url, $self->foreign_username ) );
+    return  join( '/', $self->remote_url, $self->foreign_username ) ;
 }
 
 sub get_txn_list_by_date {
diff --git a/lib/App/SD/Replica/lighthouse.pm b/lib/App/SD/Replica/lighthouse.pm
index c6345f2..b6f1b61 100644
--- a/lib/App/SD/Replica/lighthouse.pm
+++ b/lib/App/SD/Replica/lighthouse.pm
@@ -149,10 +149,10 @@ sub foreign_username {
     }
 }
 
-sub uuid {
+sub _uuid_url {
     my $self = shift;
     Carp::cluck "- can't make a uuid for this" unless ($self->remote_url && $self->account && $self->project );
-    return $self->uuid_for_url( join( '/', $self->remote_url, $self->project ) );
+    return  join( '/', $self->remote_url, $self->project );
 }
 
 sub remote_uri_path_for_comment {
diff --git a/lib/App/SD/Replica/redmine.pm b/lib/App/SD/Replica/redmine.pm
index 8c23a92..add0831 100644
--- a/lib/App/SD/Replica/redmine.pm
+++ b/lib/App/SD/Replica/redmine.pm
@@ -57,10 +57,10 @@ sub BUILD {
 
 sub record_pushed_transactions {}
 
-sub uuid {
+sub _uuid_url {
     my $self = shift;
     Carp::cluck "- can't make a uuid for this" unless ($self->remote_url);
-    return $self->uuid_for_url($self->remote_url);
+    return $self->remote_url;
 }
 
 sub remote_uri_path_for_id {
diff --git a/lib/App/SD/Replica/rt.pm b/lib/App/SD/Replica/rt.pm
index 4f5b21d..65a040f 100644
--- a/lib/App/SD/Replica/rt.pm
+++ b/lib/App/SD/Replica/rt.pm
@@ -90,9 +90,9 @@ Return the replica's UUID
 
 =cut
 
-sub uuid {
+sub _uuid_url {
     my $self = shift;
-    return $self->uuid_for_url( join( '/', $self->remote_url, $self->query ) );
+    return join( '/', $self->remote_url, $self->query );
 
 }
 
diff --git a/lib/App/SD/Replica/trac.pm b/lib/App/SD/Replica/trac.pm
index e2dd8c1..9a2b9af 100644
--- a/lib/App/SD/Replica/trac.pm
+++ b/lib/App/SD/Replica/trac.pm
@@ -76,9 +76,9 @@ Return the replica's UUID
 
 =cut
 
-sub uuid {
+sub _uuid_url {
     my $self = shift;
-    return $self->uuid_for_url( $self->remote_url);
+    return $self->remote_url;
 }
 
 sub remote_uri_path_for_comment {

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list