[svk-commit] r2412 - in branches/svk-logger/lib/SVK: .

nobody at bestpractical.com nobody at bestpractical.com
Thu Jun 21 05:03:18 EDT 2007


Author: clsung
Date: Thu Jun 21 05:03:15 2007
New Revision: 2412

Modified:
   branches/svk-logger/lib/SVK/Command.pm
   branches/svk-logger/lib/SVK/Command/Add.pm
   branches/svk-logger/lib/SVK/Command/Annotate.pm
   branches/svk-logger/lib/SVK/Command/Checkout.pm
   branches/svk-logger/lib/SVK/Command/Cleanup.pm
   branches/svk-logger/lib/SVK/Command/Depotmap.pm
   branches/svk-logger/lib/SVK/Command/Help.pm
   branches/svk-logger/lib/SVK/Command/Ignore.pm
   branches/svk-logger/lib/SVK/Command/Import.pm
   branches/svk-logger/lib/SVK/Command/Info.pm
   branches/svk-logger/lib/SVK/Command/List.pm
   branches/svk-logger/lib/SVK/Command/Merge.pm
   branches/svk-logger/lib/SVK/Command/Mirror.pm
   branches/svk-logger/lib/SVK/Command/Patch.pm
   branches/svk-logger/lib/SVK/Command/Propget.pm
   branches/svk-logger/lib/SVK/Command/Proplist.pm
   branches/svk-logger/lib/SVK/Command/Status.pm
   branches/svk-logger/lib/SVK/Command/Verify.pm
   branches/svk-logger/lib/SVK/Editor.pm
   branches/svk-logger/lib/SVK/Test.pm

Log:
- obra's patch

Modified: branches/svk-logger/lib/SVK/Command.pm
==============================================================================
--- branches/svk-logger/lib/SVK/Command.pm	(original)
+++ branches/svk-logger/lib/SVK/Command.pm	Thu Jun 21 05:03:15 2007
@@ -56,7 +56,7 @@
 
 use SVK::Logger;
 use SVK::Util qw( get_prompt abs2rel abs_path is_uri catdir bsd_glob from_native
-		  find_svm_source $SEP IS_WIN32 catdepot traverse_history);
+		  find_svm_source $SEP IS_WIN32 catdepot traverse_history );
 use SVK::I18N;
 use Encode;
 use constant subcommands => '*';
@@ -164,9 +164,9 @@
 				 output => $output) };
 
     $ofh = select STDERR unless $output;
-    print $ret if $ret && $ret !~ /^\d+$/;
-    unless (ref($@)) {
-	print $@ if $@;
+    $logger->info( $ret) if $ret && $ret !~ /^\d+$/;
+    if ($@ && ref($@)) {
+        $logger->info("$@");
     }
     $ret = 1 if ($ret ? $ret !~ /^\d+$/ : $@);
 
@@ -479,7 +479,7 @@
     $m = $target->is_mirrored;
     # If the user is mirroring from svn
     if ($m) {
-        print loc("
+        $logger->info( loc("
 svk needs to mirror the remote repository so you can work locally.
 If you're mirroring a single branch, it's safe to use any of the options
 below.
@@ -489,13 +489,13 @@
 with a recent revision can result in a larger local repository and will
 break history-sensitive merging within the mirrored path.
 
-");
+"),
 
-        print loc("Synchronizing the mirror for the first time:\n");
-        print loc("  a        : Retrieve all revisions (default)\n");
-        print loc("  h        : Only the most recent revision\n");
-        print loc("  -count   : At most 'count' recent revisions\n");
-        print loc("  revision : Start from the specified revision\n");
+         loc("Synchronizing the mirror for the first time:\n"),
+         loc("  a        : Retrieve all revisions (default)\n"),
+         loc("  h        : Only the most recent revision\n"),
+         loc("  -count   : At most 'count' recent revisions\n"),
+         loc("  revision : Start from the specified revision\n"));
 
         $answer = lc(get_prompt(
             loc("a)ll, h)ead, -count, revision? [a] "),
@@ -525,7 +525,7 @@
 
     my $depotpath = length ($rel_uri) ? $target->depotpath."/$rel_uri" : $target->depotpath;
     if (my $err = $@) {
-	print loc("Unable to complete initial sync: %1", $err);
+	$logger->info(loc("Unable to complete initial sync: %1", $err));
 	die loc("Run svk sync %1, and run the %2 command again.\n", $depotpath, lc((ref($self) =~ m/::([^:]*)$/)[0]));
     }
 
@@ -818,7 +818,7 @@
     local $/=undef;
     my $buf = <$podfh>;
     if($buf =~ /^=head1\s+NAME\s*SVK::Command::(\w+ - .+)$/m) {
-	print "   ",loc(lcfirst($1)),"\n";
+	$logger->info( "   ",loc(lcfirst($1)),"\n");
     }
     close $podfh;
 }
@@ -871,15 +871,15 @@
                 my $spaces = $3;
                 my $loc = $1 . loc($2 . ($4||'')) . $5;
                 $loc =~ s/: /$spaces: / if $spaces;
-                print $loc, "\n";
+                $logger->info( $loc, "\n");
             }
-            print "\n";
+            $logger->info( "\n");
 	}
         elsif ($line =~ /^(\s+)(\w+ - .*)$/) {
-            print $1, loc($2), "\n\n";
+            $logger->info( $1, loc($2), "\n\n");
         }
         elsif (length $line) {
-            print loc($line), "\n\n";
+            $logger->info( loc($line), "\n\n");
 	}
     }
 }
@@ -928,7 +928,7 @@
     my ($self, $err, $msg) = @_;
     $self->add_handler
 	($err, sub {
-	     print $_[0]->expanded_message."\n".($msg ? "$msg\n" : '');
+	     $logger->info( $_[0]->expanded_message."\n".($msg ? "$msg\n" : ''));
 	 });
 }
 
@@ -1063,9 +1063,9 @@
 sub _run_code {
     my ($self, $target, $code, $level, $errs, $kind) = @_;
     eval { $code->( $target, $kind, $level ) };
-    if ($@) {
-	print $@;
-	push @$errs, "$@";
+    if (my $err = "$@") {
+	$logger->info( $err);
+	push @$errs, $err;
     }
 }
 
@@ -1078,7 +1078,7 @@
         if $kind == $SVN::Node::dir
         && $self->{recursive}
         && ( !$self->{depth} || 0 < $self->{depth} );
-    print "\n" if $newline;
+    $logger->info( "\n") if $newline;
 }
 
 sub _descend_with {

Modified: branches/svk-logger/lib/SVK/Command/Add.pm
==============================================================================
--- branches/svk-logger/lib/SVK/Command/Add.pm	(original)
+++ branches/svk-logger/lib/SVK/Command/Add.pm	Thu Jun 21 05:03:15 2007
@@ -56,6 +56,7 @@
 use constant opt_recursive => 1;
 use SVK::XD;
 use SVK::I18N;
+use SVK::Logger;
 use SVK::Util qw( $SEP is_symlink mimetype_is_text to_native);
 
 sub options {
@@ -140,7 +141,7 @@
         $bin = ' - (bin)' if !mimetype_is_text( $newprop->{'svn:mime-type'} );
     }
 
-    print "$st   $report$bin\n";
+    $logger->info( "$st   $report$bin\n");
 }
 
 1;

Modified: branches/svk-logger/lib/SVK/Command/Annotate.pm
==============================================================================
--- branches/svk-logger/lib/SVK/Command/Annotate.pm	(original)
+++ branches/svk-logger/lib/SVK/Command/Annotate.pm	Thu Jun 21 05:03:15 2007
@@ -55,6 +55,7 @@
 use SVK::XD;
 use SVK::I18N;
 use SVK::Util qw( traverse_history );
+use SVK::Logger;
 use Algorithm::Annotate;
 
 sub options {
@@ -91,9 +92,9 @@
         }
     );
 
-    print loc("Annotations for %1 (%2 active revisions):\n", $target->path, scalar @paths);
-    print '*' x 16;
-    print "\n";
+    $logger->info(loc("Annotations for %1 (%2 active revisions):\n", $target->path, scalar @paths));
+    $logger->info( '*' x 16);
+    $logger->info("\n");
     for my $t (@paths) {
 	local $/;
 	my $content = $t->root->file_contents($t->path);
@@ -120,7 +121,7 @@
 
     my $result = $ann->result;
     while (my $info = shift @$result) {
-	print $info, shift(@$final), "\n";
+        $logger->info($info, shift(@$final), "\n");
     }
 
 }

Modified: branches/svk-logger/lib/SVK/Command/Checkout.pm
==============================================================================
--- branches/svk-logger/lib/SVK/Command/Checkout.pm	(original)
+++ branches/svk-logger/lib/SVK/Command/Checkout.pm	Thu Jun 21 05:03:15 2007
@@ -57,6 +57,7 @@
 use SVK::I18N;
 use SVK::Util qw( get_anchor abs_path move_path splitdir $SEP get_encoding abs_path_noexist catfile );
 use File::Path;
+use SVK::Logger;
 
 sub options {
     ($_[0]->SUPER::options,
@@ -207,6 +208,7 @@
 
 package SVK::Command::Checkout::list;
 use base qw( SVK::Command::Checkout );
+use SVK::Logger;
 use SVK::I18N;
 
 sub parse_arg { undef }
@@ -217,15 +219,16 @@
     my ($self) = @_;
     my $map = $self->{xd}{checkout}{hash};
     my $fmt = "%1s %-30s\t%-s\n";
-    printf $fmt, ' ', loc('Depot Path'), loc('Path');
-    print '=' x 72, "\n";
-    print sort(map sprintf($fmt, -e $_ ? ' ' : '?', $map->{$_}{depotpath}, $_), grep $map->{$_}{depotpath}, keys %$map);
+    $logger->info(sprintf $fmt, ' ', loc('Depot Path'), loc('Path')); 
+     $logger->info('=' x 72, "\n");
+    $logger->info( sort(map sprintf($fmt, -e $_ ? ' ' : '?', $map->{$_}{depotpath}, $_), grep $map->{$_}{depotpath}, keys %$map));
     return;
 }
 
 package SVK::Command::Checkout::relocate;
 use base qw( SVK::Command::Checkout );
 use SVK::Util qw( get_anchor abs_path move_path splitdir $SEP );
+use SVK::Logger;
 use SVK::I18N;
 
 sub parse_arg {
@@ -275,13 +278,14 @@
     $relocate->($hmap);
     $relocate->($self->{xd}{checkout}{sticky});
 
-    print loc("Checkout '%1' relocated to '%2'.\n", $path, $target);
+    $logger->info( loc("Checkout '%1' relocated to '%2'.\n", $path, $target));
 
     return;
 }
 
 package SVK::Command::Checkout::detach;
 use base qw( SVK::Command::Checkout );
+use SVK::Logger;
 use SVK::I18N;
 
 sub parse_arg {
@@ -307,7 +311,7 @@
         foreach my $copath (sort @copath) {
             $checkout->store ($copath, {_remove_entry, $self->_schedule_empty},
                              {override_sticky_descendents => 1});
-            print loc("Checkout path '%1' detached.\n", $copath);
+            $logger->info( loc("Checkout path '%1' detached.\n", $copath));
         }
     }
 

Modified: branches/svk-logger/lib/SVK/Command/Cleanup.pm
==============================================================================
--- branches/svk-logger/lib/SVK/Command/Cleanup.pm	(original)
+++ branches/svk-logger/lib/SVK/Command/Cleanup.pm	Thu Jun 21 05:03:15 2007
@@ -54,6 +54,7 @@
 
 use base qw( SVK::Command );
 use SVK::I18N;
+use SVK::Logger;
 
 sub options {
     ('a|all' => 'all');
@@ -72,17 +73,17 @@
 
     if ($self->{all}) {
         $self->{xd}{checkout}->store ('', {lock => undef});
-        print loc("Cleaned up all stalled locks.\n");
+        $logger->info( loc("Cleaned up all stalled locks.\n"));
         return;
     }
 
     for (@arg) {
 	if ($self->{xd}{checkout}->get ($_->copath_anchor)->{lock}) {
-	    print loc("Cleaned up stalled lock on %1.\n", $_->copath_anchor);
+	    $logger->info( loc("Cleaned up stalled lock on %1.\n", $_->copath_anchor));
 	    $self->{xd}{checkout}->store ($_->copath_anchor, {lock => undef});
 	}
         else {
-	    print loc("Path %1 was not locked.\n", $_->copath_anchor);
+	    $logger->info(loc("Path %1 was not locked.\n", $_->copath_anchor));
 	}
     }
     return;

Modified: branches/svk-logger/lib/SVK/Command/Depotmap.pm
==============================================================================
--- branches/svk-logger/lib/SVK/Command/Depotmap.pm	(original)
+++ branches/svk-logger/lib/SVK/Command/Depotmap.pm	Thu Jun 21 05:03:15 2007
@@ -55,6 +55,7 @@
 use base qw( SVK::Command );
 use SVK::XD;
 use SVK::I18N;
+use SVK::Logger;
 use SVK::Util qw( get_buffer_from_editor abs_path move_path );
 use YAML::Syck;
 use File::Path;
@@ -109,9 +110,9 @@
               get_buffer_from_editor( loc('depot map'), $sep, "$map\n$sep\n",
                 'depotmap' );
             $new = eval { YAML::Syck::Load($map) };
-            print "$@\n" if $@;
+            $logger->info("$@\n") if $@;
         } while ($@);
-        print loc("New depot map saved.\n");
+        $logger->info( loc("New depot map saved.\n"));
         $self->{xd}{depotmap} = $new;
     }
     $self->{xd}->create_depots;
@@ -120,6 +121,7 @@
 
 package SVK::Command::Depotmap::add;
 use base qw(SVK::Command::Depotmap);
+use SVK::Logger;
 use SVK::I18N;
 
 sub run {
@@ -130,12 +132,13 @@
 
     $self->{xd}{depotmap}{$depot} = $path;
 
-    print loc("New depot map saved.\n");
+    $logger->info(loc("New depot map saved.\n"));
     $self->{xd}->create_depots;
 }
 
 package SVK::Command::Depotmap::relocate;
 use base qw(SVK::Command::Depotmap);
+use SVK::Logger;
 use SVK::I18N;
 
 sub run {
@@ -146,12 +149,13 @@
 
     $self->{xd}{depotmap}{$depot} = $path;
 
-    print loc("Depot '%1' relocated to '%2'.\n", $depot, $path);
+    $logger->info( loc("Depot '%1' relocated to '%2'.\n", $depot, $path));
     $self->{xd}->create_depots;
 }
 
 package SVK::Command::Depotmap::detach;
 use base qw(SVK::Command::Depotmap);
+use SVK::Logger;
 use SVK::I18N;
 
 sub run {
@@ -159,12 +163,13 @@
     delete $self->{xd}{depotmap}{$depot}
         or die loc("Depot '%1' does not exist in the depot map.\n", $depot);
 
-    print loc("Depot '%1' detached.\n", $depot);
+    $logger->info( loc("Depot '%1' detached.\n", $depot));
     return;
 }
 
 package SVK::Command::Depotmap::list;
 use base qw(SVK::Command::Depotmap);
+use SVK::Logger;
 use SVK::I18N;
 
 sub parse_arg { undef }
@@ -173,9 +178,9 @@
     my ($self) = @_;
     my $map = $self->{xd}{depotmap};
     my $fmt = "%-20s\t%-s\n";
-    printf $fmt, loc('Depot'), loc('Path');
-    print '=' x 60, "\n";
-    printf $fmt, "/$_/", $map->{$_} for sort keys %$map;
+    $logger->info(sprintf $fmt, loc('Depot'), loc('Path'));
+    $logger->info( '=' x 60, "\n");
+    $logger->info(sprintf $fmt, "/$_/", $map->{$_}) for sort keys %$map;
     return;
 }
 

Modified: branches/svk-logger/lib/SVK/Command/Help.pm
==============================================================================
--- branches/svk-logger/lib/SVK/Command/Help.pm	(original)
+++ branches/svk-logger/lib/SVK/Command/Help.pm	Thu Jun 21 05:03:15 2007
@@ -54,6 +54,7 @@
 
 use base qw( SVK::Command );
 use SVK::I18N;
+use SVK::Logger;
 use SVK::Util qw( get_encoder can_run );
 use autouse 'File::Find' => qw(find);
 
@@ -74,7 +75,7 @@
             my @cmd;
             my $dir = $INC{'SVK/Command.pm'};
             $dir =~ s/\.pm$//;
-            print loc("Available commands:\n");
+            $logger->info( loc("Available commands:\n"));
             find (
                 sub { push @cmd, $File::Find::name if m/\.pm$/ }, $dir,
             );
@@ -92,7 +93,7 @@
 
             $buf =~ s/^NAME\s+SVK::Help::\S+ - (.+)\s+DESCRIPTION/    $1:/;
 
-            print get_encoder->encode($buf);
+            $logger->info( get_encoder->encode($buf));
         }
         else {
             die loc("Cannot find help topic '%1'.\n", $topic);

Modified: branches/svk-logger/lib/SVK/Command/Ignore.pm
==============================================================================
--- branches/svk-logger/lib/SVK/Command/Ignore.pm	(original)
+++ branches/svk-logger/lib/SVK/Command/Ignore.pm	Thu Jun 21 05:03:15 2007
@@ -53,6 +53,7 @@
 use SVK::Version;  our $VERSION = $SVK::VERSION;
 use base qw( SVK::Command );
 
+use SVK::Logger;
 use SVK::Util qw ( abs2rel );
 
 sub parse_arg {
@@ -85,7 +86,7 @@
 
     my $current_ignore_re = $self->{xd}->ignore($svn_ignore);
     if ($filename =~ m/$current_ignore_re/) {
-        print "Already ignoring '$report'\n";
+        $logger->info( "Already ignoring '$report'\n");
     } else {
         $svn_ignore .= "\n"
           if length $svn_ignore and substr($svn_ignore, -1, 1) ne "\n";

Modified: branches/svk-logger/lib/SVK/Command/Import.pm
==============================================================================
--- branches/svk-logger/lib/SVK/Command/Import.pm	(original)
+++ branches/svk-logger/lib/SVK/Command/Import.pm	Thu Jun 21 05:03:15 2007
@@ -55,6 +55,7 @@
 use base qw( SVK::Command::Commit );
 use SVK::XD;
 use SVK::I18N;
+use SVK::Logger;
 
 sub options {
     ($_[0]->SUPER::options,
@@ -104,7 +105,7 @@
         mkdir => { message => "Directory for svk import.", parent => 1 },
     )->run ($target);
 
-    print loc("Import path %1 initialized.\n", $target->depotpath);
+    $logger->info( loc("Import path %1 initialized.\n", $target->depotpath));
 }
 
 sub run {
@@ -119,7 +120,7 @@
     my $basetarget = $target;
     if ($kind == $SVN::Node::none) {
 	if ($self->{check_only}) {
-	    print loc("Import path %1 will be created.\n", $target->depotpath);
+	    $logger->info( loc("Import path %1 will be created.\n", $target->depotpath));
 	    $basetarget = $target->new (revision => 0, path => '/');
 	}
 	else {
@@ -141,8 +142,8 @@
     $self->get_commit_message () unless $self->{check_only};
     my $committed =
 	sub { my $yrev = $_[0];
-	      print loc("Directory %1 imported to depotpath %2 as revision %3.\n",
-			$copath, $target->depotpath, $yrev);
+	      $logger->info( loc("Directory %1 imported to depotpath %2 as revision %3.\n",
+			$copath, $target->depotpath, $yrev));
 
 	      if ($self->{to_checkout}) {
                   $self->{xd}{checkout}->store (
@@ -172,8 +173,8 @@
 			 copath_anchor => $copath }), $root, $editor, %cb);
 
     if ($self->{check_only}) {
-	print loc("Directory %1 will be imported to depotpath %2.\n",
-		  $copath, $target->depotpath);
+	$logger->info( loc("Directory %1 will be imported to depotpath %2.\n",
+		  $copath, $target->depotpath));
 	$self->{xd}{checkout}->store
 	    ($copath, {depotpath => undef,
 		       revision => undef,

Modified: branches/svk-logger/lib/SVK/Command/Info.pm
==============================================================================
--- branches/svk-logger/lib/SVK/Command/Info.pm	(original)
+++ branches/svk-logger/lib/SVK/Command/Info.pm	Thu Jun 21 05:03:15 2007
@@ -58,6 +58,7 @@
 use SVK::Merge;
 use SVK::I18N;
 use YAML::Syck;
+use SVK::Logger;
 use autouse 'SVK::Util' => qw( reformat_svn_date );
 
 # XXX: provide -r which walks peg to the specified revision based on
@@ -93,33 +94,33 @@
 
     my ($m, $mpath) = $target->is_mirrored;
 
-    print loc("Checkout Path: %1\n",$target->copath)
+    $logger->info( loc("Checkout Path: %1\n",$target->copath))
 	if $target->isa('SVK::Path::Checkout');
-    print loc("Depot Path: %1\n", $target->depotpath);
-    print loc("Revision: %1\n", $target->revision);
+    $logger->info( loc("Depot Path: %1\n", $target->depotpath));
+    $logger->info( loc("Revision: %1\n", $target->revision));
     if (defined( my $lastchanged = $target->root->node_created_rev( $target->path ))) {
-        print loc( "Last Changed Rev.: %1\n", $lastchanged );
+        $logger->info( loc( "Last Changed Rev.: %1\n", $lastchanged ));
         my $date
             = $target->root->fs->revision_prop( $lastchanged, 'svn:date' );
-        print loc(
+        $logger->info( loc(
             "Last Changed Date: %1\n",
             reformat_svn_date( "%F", $date )
-        );
+        ));
     }
 
-    print loc("Mirrored From: %1, Rev. %2\n",$m->url, $m->fromrev)
+    $logger->info( loc("Mirrored From: %1, Rev. %2\n",$m->url, $m->fromrev))
 	if $m;
 
     for ($target->copy_ancestors) {
-	print loc("Copied From: %1, Rev. %2\n", $_->[0], $_->[1]);
+	$logger->info( loc("Copied From: %1, Rev. %2\n", $_->[0], $_->[1]));
     }
 
     $self->{merge} = SVK::Merge->new (%$self);
     my $minfo = $self->{merge}->find_merge_sources ($target, 0,1);
     for (sort { $minfo->{$b} <=> $minfo->{$a} } keys %$minfo) {
-	print loc("Merged From: %1, Rev. %2\n",(split/:/)[1],$minfo->{$_});
+	$logger->info( loc("Merged From: %1, Rev. %2\n",(split/:/)[1],$minfo->{$_}));
     }
-    print "\n";
+    $logger->info( "\n");
 }
 
 1;

Modified: branches/svk-logger/lib/SVK/Command/List.pm
==============================================================================
--- branches/svk-logger/lib/SVK/Command/List.pm	(original)
+++ branches/svk-logger/lib/SVK/Command/List.pm	Thu Jun 21 05:03:15 2007
@@ -57,6 +57,7 @@
 use SVK::XD;
 use SVK::I18N;
 use SVK::Util qw( to_native get_encoder reformat_svn_date );
+use SVK::Logger;
 
 sub options {
     ('r|revision=s'  => 'rev',
@@ -112,10 +113,10 @@
         no warnings 'uninitialized';
 
         # Additional fields for verbose: revision author size datetime
-        printf "%7ld %-8.8s %10s %12s ", $rev,
+        $logger->info(sprintf ("%7ld %-8.8s %10s %12s ", $rev,
             $fs->revision_prop( $rev, 'svn:author' ),
             ($kind == $SVN::Node::dir) ? "" : $root->file_length( $target->path ),
-            reformat_svn_date( "%b %d %H:%M", $svn_date );
+            reformat_svn_date( "%b %d %H:%M", $svn_date )));
     }
 
     my $output_path;
@@ -123,13 +124,13 @@
         $output_path = $target->report;
     }
     else {
-        print " " x ($level-1);
+        $logger->info( " " x ($level-1));
         $output_path = Path::Class::File->new_foreign( 'Unix', $target->path )
             ->basename;
     }
     to_native( $output_path, 'path', $enc );
-    print $output_path;
-    print( ( $kind == $SVN::Node::dir ? '/' : '' ) . "\n" );
+    $logger->info( $output_path);
+    $logger->info( ( $kind == $SVN::Node::dir ? '/' : '' ) . "\n" );
 
 }
 

Modified: branches/svk-logger/lib/SVK/Command/Merge.pm
==============================================================================
--- branches/svk-logger/lib/SVK/Command/Merge.pm	(original)
+++ branches/svk-logger/lib/SVK/Command/Merge.pm	Thu Jun 21 05:03:15 2007
@@ -56,6 +56,7 @@
 use SVK::XD;
 use SVK::I18N;
 use SVK::Command::Log;
+use SVK::Logger;
 use SVK::Merge;
 use SVK::Util qw( get_buffer_from_editor traverse_history );
 
@@ -169,8 +170,8 @@
 	$merge = SVK::Merge->auto (%$self, repos => $repos, target => '',
 				   ticket => !$self->{no_ticket},
 				   src => $src, dst => $dst);
-	print $merge->info;
-	print $merge->log(1) if $self->{summary};
+	$logger->info( $merge->info);
+	$logger->info( $merge->log(1)) if $self->{summary};
     }
     else {
 	die loc("Incremental merge not supported\n") if $self->{incremental};
@@ -188,7 +189,7 @@
 
     $merge->{notice_copy} = 1;
     if ($merge->{fromrev} == $merge->{src}->revision) {
-	print loc ("Empty merge.\n");
+	$logger->info( loc ("Empty merge.\n"));
 	return;
     }
 
@@ -198,7 +199,7 @@
     if ($self->{incremental}) {
 	die loc ("Not possible to do incremental merge without a merge ticket.\n")
 	    if $self->{no_ticket};
-	print loc ("-m ignored in incremental merge\n") if $self->{message};
+	$logger->info( loc ("-m ignored in incremental merge\n")) if $self->{message};
 	my @rev;
 
         traverse_history (
@@ -226,7 +227,7 @@
 		$merge->{fromrev} = $previous_base;
 	    }
 
-	    print '===> '.$merge->info;
+	    $logger->info( '===> '.$merge->info);
 	    $self->{message} = $merge->log (1);
 	    $self->decode_commit_message;
 

Modified: branches/svk-logger/lib/SVK/Command/Mirror.pm
==============================================================================
--- branches/svk-logger/lib/SVK/Command/Mirror.pm	(original)
+++ branches/svk-logger/lib/SVK/Command/Mirror.pm	Thu Jun 21 05:03:15 2007
@@ -55,6 +55,7 @@
 use base qw( SVK::Command::Commit );
 use SVK::I18N;
 use SVK::Util qw( is_uri get_prompt traverse_history );
+use SVK::Logger;
 
 use constant narg => undef;
 
@@ -102,12 +103,13 @@
         }
     );
 
-    print loc("Mirror initialized.  Run svk sync %1 to start mirroring.\n", $target->report);
+    $logger->info( loc("Mirror initialized.  Run svk sync %1 to start mirroring.\n", $target->report));
 
     return;
 }
 
 package SVK::Command::Mirror::relocate;
+use SVK::Logger;
 use base qw(SVK::Command::Mirror);
 use SVK::I18N;
 
@@ -121,7 +123,7 @@
 
     $m->relocate($source, @options);
 
-    print loc("Mirror relocated.\n");
+    $logger->info( loc("Mirror relocated.\n"));
     return;
 }
 
@@ -129,6 +131,7 @@
 use base qw(SVK::Command::Mirror);
 use SVK::I18N;
 
+use SVK::Logger;
 use constant narg => 1;
 
 sub run {
@@ -139,38 +142,41 @@
     die loc("%1 is inside a mirrored path.\n", $target->depotpath) if $mpath;
 
     $m->detach(1); # remove svm:source and svm:uuid too
-    print loc("Mirror path '%1' detached.\n", $target->depotpath);
+    $logger->info( loc("Mirror path '%1' detached.\n", $target->depotpath));
     return;
 }
 
 package SVK::Command::Mirror::upgrade;
 use base qw(SVK::Command::Mirror);
 use SVK::I18N;
+use SVK::Logger;
 
 use constant narg => 1;
 
 sub run {
     my ($self, $target) = @_;
-    print loc("nothing to upgrade\n");
+    $logger->info( loc("nothing to upgrade\n"));
     return;
 }
 
 package SVK::Command::Mirror::unlock;
 use base qw(SVK::Command::Mirror);
 use SVK::I18N;
+use SVK::Logger;
 
 use constant narg => 1;
 
 sub run {
     my ($self, $target) = @_;
     $target->depot->mirror->unlock($target->path_anchor);
-    print loc ("mirror locks on %1 removed.\n", $target->report);
+    $logger->info( loc ("mirror locks on %1 removed.\n", $target->report));
     return;
 }
 
 package SVK::Command::Mirror::list;
 use base qw(SVK::Command::Mirror);
 use SVK::I18N;
+use SVK::Logger;
 use List::Util qw( max );
 
 sub parse_arg {
@@ -208,10 +214,10 @@
     my $max_uri        = max map { length $_->[1] } @mirror_columns;
 
     my $fmt = "%-${max_depot_path}s   %-s\n";
-    printf $fmt, loc('Path'), loc('Source');
-    print '=' x ( $max_depot_path + $max_uri + 3 ), "\n";
+    $logger->info(sprintf $fmt, loc('Path'), loc('Source'));
+    $logger->info( '=' x ( $max_depot_path + $max_uri + 3 ), "\n");
 
-    printf $fmt, @$_ for @mirror_columns;
+    $logger->info(sprintf $fmt, @$_ )for @mirror_columns;
 
     return;
 }
@@ -295,7 +301,7 @@
         propset => { direct  => 1, revprop => 1 },
     )->run($_ => $props->{$_}, $target) for sort grep {m/^sv[nm]/} keys %$props;
 
-    print loc("Mirror state successfully recovered.\n");
+    $logger->info( loc("Mirror state successfully recovered.\n"));
     return;
 }
 
@@ -311,7 +317,7 @@
         $self->arg_depotpath ('/'.$target->depotname.'/'),
     );
 
-    print loc("%1 added back to the list of mirrored paths.\n", $target->report);
+    $logger->info( loc("%1 added back to the list of mirrored paths.\n", $target->report));
     return;
 }
 

Modified: branches/svk-logger/lib/SVK/Command/Patch.pm
==============================================================================
--- branches/svk-logger/lib/SVK/Command/Patch.pm	(original)
+++ branches/svk-logger/lib/SVK/Command/Patch.pm	Thu Jun 21 05:03:15 2007
@@ -59,7 +59,7 @@
 use SVK::Editor::Merge;
 use SVK::I18N;
 use SVK::Command::Log;
-
+use SVK::Logger;
 
 sub options {
     (
@@ -112,6 +112,7 @@
 
 package SVK::Command::Patch::FileRequired;
 use base qw/SVK::Command::Patch/;
+use SVK::Logger;
 use SVK::I18N;
 
 sub parse_arg {
@@ -132,12 +133,13 @@
 }
 
 package SVK::Command::Patch::dump;
+use SVK::Logger;
 
 use base qw/SVK::Command::Patch::FileRequired/;
 
 sub run {
     my ($self, $patch) = @_;
-    print YAML::Syck::Dump ($patch);
+    $logger->info( YAML::Syck::Dump ($patch));
     return;
 }
 
@@ -161,6 +163,7 @@
 
 package SVK::Command::Patch::regen;
 use SVK::I18N;
+use SVK::Logger;
 
 use base qw/SVK::Command::Patch::FileRequired/;
 
@@ -206,6 +209,7 @@
 package SVK::Command::Patch::list;
 
 use base qw/SVK::Command::Patch/;
+use SVK::Logger;
 
 sub parse_arg { undef }
 sub run {
@@ -215,10 +219,10 @@
 	next if $file =~ /^\./;
 	$file =~ s/\.patch$// or next;
 	my ($patch, $not_applicable) = $self->_load ($file);
-	print "$patch->{name}\@$patch->{level}: ";
-	print "[n/a]"
+	$logger->info( "$patch->{name}\@$patch->{level}: ");
+	$logger->info( "[n/a]")
 	    if $not_applicable;
-	print "\n";
+	$logger->info( "\n");
     }
     return;
 }
@@ -227,6 +231,7 @@
 use SVK::I18N;
 
 use base qw/SVK::Command::Patch::FileRequired/;
+use SVK::Logger;
 
 sub run {
     my ($self, $patch, $not_applicable, @args) = @_;

Modified: branches/svk-logger/lib/SVK/Command/Propget.pm
==============================================================================
--- branches/svk-logger/lib/SVK/Command/Propget.pm	(original)
+++ branches/svk-logger/lib/SVK/Command/Propget.pm	Thu Jun 21 05:03:15 2007
@@ -51,7 +51,7 @@
 package SVK::Command::Propget;
 use strict;
 use SVK::Version;  our $VERSION = $SVK::VERSION;
-
+use SVK::Logger;
 use base qw( SVK::Command::Proplist );
 use constant opt_recursive => 0;
 use SVK::XD;
@@ -81,10 +81,10 @@
             my $proplist = $self->_proplist($target);
             exists $proplist->{$pname} or return;
 
-            print $target->report, ' - '
+            $logger->info( $target->report, ' - ')
                 if !$self->{strict} && ( $self->{recursive} || @targets > 1 );
-            print $proplist->{$pname};
-            print "\n" if !$self->{strict};
+            $logger->info( $proplist->{$pname});
+            $logger->info( "\n" )if !$self->{strict};
         }, $errs, 0,
     ) for @targets;
 

Modified: branches/svk-logger/lib/SVK/Command/Proplist.pm
==============================================================================
--- branches/svk-logger/lib/SVK/Command/Proplist.pm	(original)
+++ branches/svk-logger/lib/SVK/Command/Proplist.pm	Thu Jun 21 05:03:15 2007
@@ -56,6 +56,7 @@
 use constant opt_recursive => 0;
 use SVK::XD;
 use SVK::I18N;
+use SVK::Logger;
 
 sub options {
     ('v|verbose' => 'verbose',
@@ -106,15 +107,15 @@
     %$props or return;
 
     if ($self->{revprop}) {
-        print loc("Unversioned properties on revision %1:\n", $rev);
+        $logger->info( loc("Unversioned properties on revision %1:\n", $rev));
     }
     else {
-        print loc("Properties on %1:\n", length $target->report ? $target->report : '.');
+        $logger->info( loc("Properties on %1:\n", length $target->report ? $target->report : '.'));
     }
 
     for my $key (sort keys %$props) {
         my $value = $props->{$key};
-        print $self->{verbose} ? "  $key: $value\n" : "  $key\n";
+        $logger->info( $self->{verbose} ? "  $key: $value\n" : "  $key\n");
     }
 }
 

Modified: branches/svk-logger/lib/SVK/Command/Status.pm
==============================================================================
--- branches/svk-logger/lib/SVK/Command/Status.pm	(original)
+++ branches/svk-logger/lib/SVK/Command/Status.pm	Thu Jun 21 05:03:15 2007
@@ -57,6 +57,7 @@
 use SVK::XD;
 use SVK::Editor::Status;
 use SVK::Util qw( abs2rel );
+use SVK::Logger;
 
 sub options {
     ("q|quiet"    => 'quiet',
@@ -71,8 +72,8 @@
     return $self->arg_condensed (@arg);
 }
 
-sub flush_print {
-    my ($root, $target, $entry, $status, $baserev, $from_path, $from_rev) = @_;
+sub _flush_print {
+    my ($self, $root, $target, $entry, $status, $baserev, $from_path, $from_rev) = @_;
     my ($crev, $author);
     my $fs = $root->fs;
     if ($from_path) {
@@ -99,11 +100,11 @@
 	? SVK::Path::Checkout->copath ($report, $entry)
 	: SVK::Path::Checkout->copath ('', length $report ? $report : '.');
     no warnings 'uninitialized';
-    print sprintf ("%1s%1s%1s %8s %8s %-12.12s \%s\n", @{$status}[0..2],
+    $logger->info(sprintf ("%1s%1s%1s %8s %8s %-12.12s \%s\n", @{$status}[0..2],
                    defined $baserev ? $baserev : '? ',
 		   defined $crev ? $crev : '? ',
 		   $author ? $author : ' ?',
-                   $newentry);
+                   $newentry));
 }
 
 sub run {
@@ -114,7 +115,7 @@
 	  (notify => SVK::Notify->new (
 	       flush_baserev => 1,
 	       flush_unchanged => 1,
-	       cb_flush => sub { flush_print ($target->root, $target, @_); }
+	       cb_flush => sub { _flush_print ($self, $target->root, $target, @_); }
 	   )
 	  )                :
 	  (notify => SVK::Notify->new_with_report ($target->report,

Modified: branches/svk-logger/lib/SVK/Command/Verify.pm
==============================================================================
--- branches/svk-logger/lib/SVK/Command/Verify.pm	(original)
+++ branches/svk-logger/lib/SVK/Command/Verify.pm	Thu Jun 21 05:03:15 2007
@@ -52,6 +52,7 @@
 use strict;
 use SVK::Version;  our $VERSION = $SVK::VERSION;
 use SVK::I18N;
+use SVK::Logger;
 
 use base qw( SVK::Command );
 
@@ -79,8 +80,7 @@
 			  );
 
     return loc ("Signature verification failed.\n") if $editor->{fail};
-    print "Signature verified.\n";
-    return;
+    return loc( "Signature verified.\n");
 }
 
 sub run {
@@ -90,13 +90,14 @@
     my $sig = $fs->revision_prop ($chg, 'svk:signature');
     return _verify($target->depot, $sig, $chg)
 	if $sig;
-    print "No signature found for change $chg at /$depot/.\n";
+    $logger->info( "No signature found for change $chg at /$depot/.\n");
     return;
 }
 
 # XXX: Don't need this editor once root->paths_changed is available.
 package SVK::VerifyEditor;
 use base 'SVK::Editor';
+use SVK::Logger;
 __PACKAGE__->mk_accessors(qw(depot sig));
 
 sub add_file {
@@ -125,7 +126,8 @@
     close D;
 
     if ($?) {
-	print "Can't verify signature\n";
+        warn "Self is $self";
+        $logger->info( "Can't verify signature\n");
 	$self->{fail} = 1;
 	return;
     }
@@ -140,14 +142,14 @@
 	my ($md5, $filename) = ($1, $2);
 	my $checksum = delete $self->{checksum}{"$path/$filename"};
 	if ($checksum ne $md5) {
-	    print "checksum for $path/$filename mismatched: $checksum vs $md5\n";
+	    $logger->info( "checksum for $path/$filename mismatched: $checksum vs $md5\n");
 	    $self->{fail} = 1;
 	    return;
 	}
     }
     # unsigned change
     if (my @unsig = keys %{$self->{checksum}}) {
-	print "Checksum for changed path ".join (',', @unsig)." not signed.\n";
+	$logger->info("Checksum for changed path ".join (',', @unsig)." not signed.\n");
 	$self->{fail} = 1;
     }
 }

Modified: branches/svk-logger/lib/SVK/Editor.pm
==============================================================================
--- branches/svk-logger/lib/SVK/Editor.pm	(original)
+++ branches/svk-logger/lib/SVK/Editor.pm	Thu Jun 21 05:03:15 2007
@@ -52,7 +52,6 @@
 
 use base qw(Class::Accessor::Fast);
 __PACKAGE__->mk_accessors(qw(_debug));
-
 use SVK::Editor::ByPass;
 
 sub new {
@@ -82,8 +81,11 @@
     return $func =~ m/^(?:add|open|absent)/ ? 1 : 0;
 }
 
+
 # XXX: original behaviour of svn::delta::editor is "don't care" on
 # methods not implemented.  we shuold probably do warn and fix them.
-sub AUTOLOAD {}
+sub AUTOLOAD { 
+
+}
 
 1;

Modified: branches/svk-logger/lib/SVK/Test.pm
==============================================================================
--- branches/svk-logger/lib/SVK/Test.pm	(original)
+++ branches/svk-logger/lib/SVK/Test.pm	Thu Jun 21 05:03:15 2007
@@ -202,6 +202,7 @@
     my $depotmap = {map {$_ => (new_repos())[0]} '', at depot};
     my $xd = SVK::XD->new (depotmap => $depotmap,
 			   svkpath => $depotmap->{''});
+               diag $output;
     my $svk = SVK->new (xd => $xd, $ENV{DEBUG_INTERACTIVE} ? () : (output => \$output));
     push @TOCLEAN, [$xd, $svk];
     return ($xd, $svk);


More information about the svk-commit mailing list