[Bps-public-commit] r15657 - in Prophet/trunk: . lib/Prophet/Test

sartak at bestpractical.com sartak at bestpractical.com
Fri Aug 29 20:16:30 EDT 2008


Author: sartak
Date: Fri Aug 29 20:16:26 2008
New Revision: 15657

Modified:
   Prophet/trunk/   (props changed)
   Prophet/trunk/lib/Prophet/Record.pm
   Prophet/trunk/lib/Prophet/Replica.pm
   Prophet/trunk/lib/Prophet/Test/Arena.pm

Log:
 r70718 at onn:  sartak | 2008-08-29 20:07:33 -0400
 Add a "display_id" method to replicas and use it when we display a replica's uuid to the user


Modified: Prophet/trunk/lib/Prophet/Record.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Record.pm	(original)
+++ Prophet/trunk/lib/Prophet/Record.pm	Fri Aug 29 20:16:26 2008
@@ -524,7 +524,7 @@
 
     return sprintf '%s@%s',
         $self->handle->changeset_creator,
-        $self->handle->uuid;
+        $self->handle->display_id;
 }
 
 =head2 _default_summary_format

Modified: Prophet/trunk/lib/Prophet/Replica.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Replica.pm	(original)
+++ Prophet/trunk/lib/Prophet/Replica.pm	Fri Aug 29 20:16:26 2008
@@ -499,7 +499,7 @@
 
     $self->log("Should I send " .$args{changeset}->original_sequence_no .
         " from ".substr($args{changeset}->original_source_uuid,0,6) . " to " .
-        substr($args{'to'}->uuid, 0, 6));
+        $args{'to'}->display_id);
 
     return undef if ( $args{'changeset'}->is_nullification || $args{'changeset'}->is_resolution );
     return undef if $args{'to'}->has_seen_changeset( $args{'changeset'} );
@@ -1087,7 +1087,7 @@
 sub log {
     my $self = shift;
     my ($msg) = validate_pos(@_, 1);
-    print STDERR "# ".substr($self->uuid,0,6)." (".$self->scheme.":".$self->url." )".": " .$msg."\n" if ($ENV{'PROPHET_DEBUG'});
+    print STDERR "# ".$self->display_id." (".$self->scheme.":".$self->url." )".": " .$msg."\n" if ($ENV{'PROPHET_DEBUG'});
 }
 
 =head2 log_fatal $MSG
@@ -1114,6 +1114,18 @@
 
 sub changeset_creator { $ENV{PROPHET_USER} || $ENV{USER} }
 
+=head2 display_id
+
+If the user has a "friendly" name for this replica, then use it. Otherwise,
+display the replica's uuid.
+
+=cut
+
+sub display_id {
+    my $self = shift;
+    return $self->uuid;
+}
+
 __PACKAGE__->meta->make_immutable;
 no Moose;
 

Modified: Prophet/trunk/lib/Prophet/Test/Arena.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Test/Arena.pm	(original)
+++ Prophet/trunk/lib/Prophet/Test/Arena.pm	Fri Aug 29 20:16:26 2008
@@ -40,7 +40,7 @@
 
         as_user($c->name => sub { 
                     my $p = Prophet::CLI->new();
-                    diag($c => $p->handle->uuid);
+                    diag($c => $p->handle->display_id);
             });
     }
     



More information about the Bps-public-commit mailing list