[Bps-public-commit] r13951 - in Prophet/trunk: . lib/Prophet/CLI/Command t

sartak at bestpractical.com sartak at bestpractical.com
Thu Jul 10 13:38:34 EDT 2008


Author: sartak
Date: Thu Jul 10 13:38:34 2008
New Revision: 13951

Modified:
   Prophet/trunk/   (props changed)
   Prophet/trunk/lib/Prophet/CLI/Command/Show.pm
   Prophet/trunk/lib/Prophet/Record.pm
   Prophet/trunk/t/export.t
   Prophet/trunk/t/real-conflicting-merge.t
   Prophet/trunk/t/simple-conflicting-merge.t

Log:
 r64052 at onn:  sartak | 2008-07-10 13:38:26 -0400
 Add a --batch option, which disables formatting. Update tests to use it


Modified: Prophet/trunk/lib/Prophet/CLI/Command/Show.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI/Command/Show.pm	(original)
+++ Prophet/trunk/lib/Prophet/CLI/Command/Show.pm	Thu Jul 10 13:38:34 2008
@@ -8,7 +8,7 @@
     my $self = shift;
 
     my $record = $self->_load_record;
-    print $record->show_props;
+    print $record->show_props(batch => $self->has_arg('batch'));
 }
 
 __PACKAGE__->meta->make_immutable;

Modified: Prophet/trunk/lib/Prophet/Record.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Record.pm	(original)
+++ Prophet/trunk/lib/Prophet/Record.pm	Thu Jul 10 13:38:34 2008
@@ -373,6 +373,8 @@
 
 sub show_props {
     my $self = shift;
+    my %args = @_;
+
     my @fields;
 
     push @fields, ["id", $self->luid ." (" . $self->uuid . ")"];
@@ -385,6 +387,8 @@
             if length($_) > $max_length;
     }
 
+    $max_length = 0 if $args{batch};
+
     my $out = join "\n",
               map { sprintf '%*s %s', -($max_length+1), "$_->[0]:", $_->[1] }
               @fields;

Modified: Prophet/trunk/t/export.t
==============================================================================
--- Prophet/trunk/t/export.t	(original)
+++ Prophet/trunk/t/export.t	Thu Jul 10 13:38:34 2008
@@ -37,11 +37,11 @@
     run_ok( 'prophet', [ 'update', '--type', 'Bug', '--uuid', $record_id, '--status' => 'stalled' ] );
     run_output_matches(
         'prophet',
-        ['show', '--type',            'Bug',             '--uuid', $record_id ],
+        ['show', '--type',            'Bug',             '--uuid', $record_id, '--batch'],
         [
-            qr/id:     (\d+) \($record_id\)/,
+            qr/id: (\d+) \($record_id\)/,
               'status: stalled',
-              'from:   alice',
+              'from: alice',
         ],
         'content is correct'
     );

Modified: Prophet/trunk/t/real-conflicting-merge.t
==============================================================================
--- Prophet/trunk/t/real-conflicting-merge.t	(original)
+++ Prophet/trunk/t/real-conflicting-merge.t	Thu Jul 10 13:38:34 2008
@@ -31,11 +31,11 @@
 
     run_output_matches(
         'prophet',
-        [ 'show', '--type',            'Bug',             '--uuid', $record_id ],
+        [ 'show', '--type',            'Bug',             '--uuid', $record_id, '--batch' ],
         [
-        qr/id:     (\d+) \($record_id\)/,
+        qr/id: (\d+) \($record_id\)/,
           'status: stalled',
-          'from:   alice',
+          'from: alice',
         ],
         'content is correct'
     );
@@ -46,11 +46,11 @@
 
     run_output_matches(
         'prophet',
-        [ 'show', '--type',            'Bug',          '--uuid', $record_id ],
+        [ 'show', '--type',            'Bug',          '--uuid', $record_id, '--batch' ],
         [
-            qr/id:     (\d+) \($record_id\)/,
+            qr/id: (\d+) \($record_id\)/,
               'status: open',
-              'from:   alice',
+              'from: alice',
         ],
         'content is correct'
     );

Modified: Prophet/trunk/t/simple-conflicting-merge.t
==============================================================================
--- Prophet/trunk/t/simple-conflicting-merge.t	(original)
+++ Prophet/trunk/t/simple-conflicting-merge.t	Thu Jul 10 13:38:34 2008
@@ -45,11 +45,11 @@
     run_ok( 'prophet', [ 'update', '--type', 'Bug', '--uuid', $record_id, '--status' => 'stalled' ] );
     run_output_matches(
         'prophet',
-        ['show', '--type',            'Bug',             '--uuid', $record_id ],
+        ['show', '--type',            'Bug',             '--uuid', $record_id, '--batch', ],
         [
-            qr/id:     (\d+) \($record_id\)/,
+            qr/id: (\d+) \($record_id\)/,
               'status: stalled',
-              'from:   alice',
+              'from: alice',
         ],
         'content is correct'
     );



More information about the Bps-public-commit mailing list