[svk-commit] r2170 - in trunk/lib/SVK: .

clkao at bestpractical.com clkao at bestpractical.com
Sat Nov 18 02:45:28 EST 2006


Author: clkao
Date: Sat Nov 18 02:45:27 2006
New Revision: 2170

Modified:
   trunk/lib/SVK/Command.pm
   trunk/lib/SVK/Command/List.pm
   trunk/lib/SVK/Command/Proplist.pm

Log:
Fix the recursive and depth sematics. also svk pl -R.

Modified: trunk/lib/SVK/Command.pm
==============================================================================
--- trunk/lib/SVK/Command.pm	(original)
+++ trunk/lib/SVK/Command.pm	Sat Nov 18 02:45:27 2006
@@ -1018,11 +1018,9 @@
 sub run_command_recursively {
     my ($self, $target, $code, $level) = @_;
     my $root = $target->root;
-    unless ((my $kind = $root->check_path ($target->path_anchor)) == $SVN::Node::dir) {
-       return;
-    }
-    $code->($target, $target->root->check_path($target->path_anchor), -1);
-    $self->_descend_with($target, $code, 0)
+    my $kind = $root->check_path($target->path_anchor);
+    $code->($target, $kind, -1);
+    $self->_descend_with($target, $code, 1) if $kind == $SVN::Node::dir && $self->{recursive} && (!$self->{depth} || 0 < $self->{depth});
 }
 
 sub _descend_with {

Modified: trunk/lib/SVK/Command/List.pm
==============================================================================
--- trunk/lib/SVK/Command/List.pm	(original)
+++ trunk/lib/SVK/Command/List.pm	Sat Nov 18 02:45:27 2006
@@ -26,6 +26,13 @@
     my $exception = '';
 
     my $enc = get_encoder;
+    if ($self->{recursive}) {
+	$self->{depth}++ if $self->{depth};
+    }
+    else {
+        $self->{recursive}++;
+        $self->{depth} = 1;
+    }
     while ( my $arg = shift @arg ) {
         $arg = $arg->as_depotpath;
         eval {
@@ -74,7 +81,7 @@
         $output_path = $target->report;
     }
     else {
-        print " " x ($level);
+        print " " x ($level-1);
         $output_path = Path::Class::File->new_foreign( 'Unix', $target->path )
             ->basename;
     }

Modified: trunk/lib/SVK/Command/Proplist.pm
==============================================================================
--- trunk/lib/SVK/Command/Proplist.pm	(original)
+++ trunk/lib/SVK/Command/Proplist.pm	Sat Nov 18 02:45:27 2006
@@ -22,24 +22,31 @@
 }
 
 sub run {
-    my ($self, @arg) = @_;
-    die loc ("Revision required.\n")
-	if $self->{revprop} && !defined $self->{rev};
-
-    for my $target (@arg) {
-        if ($self->{revprop}) {
-            $self->_show_props
-		( $target,
-		  $target->repos->fs->revision_proplist($self->{rev}),
-		  $self->{rev}
-		);
-            next;
+    my ( $self, @arg ) = @_;
+    if ( $self->{revprop} ) {
+        die loc("Revision required.\n")
+            unless defined $self->{rev};
+
+        for my $target (@arg) {
+            $self->_show_props( $target,
+                $target->repos->fs->revision_proplist( $self->{rev} ),
+                $self->{rev} );
         }
+        return;
 
-	$target = $target->as_depotpath ($self->{rev}) if defined $self->{rev};
-        $self->_show_props( $target, $target->root->node_proplist($target->path) );
     }
 
+    $self->run_command_recursively(
+        $_,
+        sub {
+            my $target = shift;
+            $target = $target->as_depotpath( $self->{rev} )
+                if defined $self->{rev};
+            $self->_show_props( $target,
+                $target->root->node_proplist( $target->path ) );
+        }
+    ) for @arg;
+
     return;
 }
 


More information about the svk-commit mailing list