[svk-commit] r2928 - in branches/mirror-boostrap/lib/SVK: Command Mirror/Backend

nobody at bestpractical.com nobody at bestpractical.com
Wed Jun 18 21:49:58 EDT 2008


Author: clsung
Date: Wed Jun 18 21:49:57 2008
New Revision: 2928

Modified:
   branches/mirror-boostrap/lib/SVK/Command/Mirror.pm
   branches/mirror-boostrap/lib/SVK/Mirror.pm
   branches/mirror-boostrap/lib/SVK/Mirror/Backend/SVNRa.pm
   branches/mirror-boostrap/lib/SVK/Notify.pm

Log:
  -    require Term::ProgressBar;
  +    require Time::Progress;

Modified: branches/mirror-boostrap/lib/SVK/Command/Mirror.pm
==============================================================================
--- branches/mirror-boostrap/lib/SVK/Command/Mirror.pm	(original)
+++ branches/mirror-boostrap/lib/SVK/Command/Mirror.pm	Wed Jun 18 21:49:57 2008
@@ -189,8 +189,8 @@
             # of quiet and gui variants.
             my $progress = SVK::Notify->new->progress(
                 {
-                    count => 1024,
-                    ETA   => 'linear',
+                    min => 0,
+                    max => 1024,
                 }
             );
             $ua->get(
@@ -201,19 +201,22 @@
                     if ($progress) {
                         unless ($did_set_target) {
                             if ( my $content_length = $cb_response->content_length ) {
-                                $progress->target($content_length);
+                                $progress->attr(max => $content_length);
                                 $did_set_target = 1;
                             }
                             else {
-                                $progress->target(
+                                $progress->attr(max => 
                                                   $received_size + 2 * length $data );
                             }
                         }
                     }
                     $received_size += length $data;
                     print { $self->{bootstrap} } $data;
-                    $next_update = $progress->update($received_size)
-                        if $progress && $received_size >= $next_update;
+		    if ($progress && $received_size >= $next_update) {
+			local $| = 1;
+			print STDERR $progress->report( "%45b %p\r", $received_size );
+			$next_update = $received_size + 1;
+		    }
                 },
                 ':read_size_hint' => 16384,
             );

Modified: branches/mirror-boostrap/lib/SVK/Mirror.pm
==============================================================================
--- branches/mirror-boostrap/lib/SVK/Mirror.pm	(original)
+++ branches/mirror-boostrap/lib/SVK/Mirror.pm	Wed Jun 18 21:49:57 2008
@@ -266,8 +266,7 @@
     my $rev = 0;
     my $buf;
     my $header;
-    my $progress = SVK::Notify->new->progress( { count => 1024, ETA => 'linear' } );
-    $progress->target( $self->_backend->_new_ra->get_latest_revnum ) if $progress;
+    my $progress = SVK::Notify->new->progress( min => 0, max => $self->_backend->_new_ra->get_latest_revnum );
     if ($self->fromrev) {
         $logger->info(loc("Skipping dumpstream up to revision %1", $self->fromrev));
     }
@@ -290,10 +289,11 @@
 	    }
 	    
 	    if ($rec->get_header('Revision-number')) {
+		$| = 1;
 		$rev = $rec->get_header('Revision-number');
 		$prev = $rev if !$prev;
 		$rec->set_property('svm:headrev',$self->source_uuid.':'.$rev."\n");
-                $progress->update($rev);
+		printf STDERR "%s rev:%d\r",$progress->report( "%45b",$rev),$rev;
 	    }
 
 

Modified: branches/mirror-boostrap/lib/SVK/Mirror/Backend/SVNRa.pm
==============================================================================
--- branches/mirror-boostrap/lib/SVK/Mirror/Backend/SVNRa.pm	(original)
+++ branches/mirror-boostrap/lib/SVK/Mirror/Backend/SVNRa.pm	Wed Jun 18 21:49:57 2008
@@ -781,7 +781,7 @@
     }
     my $progress =
       $self->mirror->{use_progress}
-      ? SVK::Notify->new->progress( { count => scalar @$revs } )
+      ? SVK::Notify->new->progress( max => scalar @$revs )
       : undef;
     my $pool = SVN::Pool->new_default;
     my $i = 0;
@@ -802,7 +802,8 @@
                 $ra->replay( $changeset, 0, 1, $editor );
                 $self->_after_replay($ra, $editor);
             }, $translate_from );
-        $progress->update( ++$i ) if $progress;
+        local $| = 1;
+        print STDERR $progress->report( "%45b %p\r", ++$i ) if $progress;
     }
     $self->_ra_finished($ra);
 }

Modified: branches/mirror-boostrap/lib/SVK/Notify.pm
==============================================================================
--- branches/mirror-boostrap/lib/SVK/Notify.pm	(original)
+++ branches/mirror-boostrap/lib/SVK/Notify.pm	Wed Jun 18 21:49:57 2008
@@ -211,11 +211,10 @@
 
 sub progress {
     my $self = shift;
-    require Term::ProgressBar;
+    require Time::Progress;
     return if $self->{quiet};
-    my $progress = Term::ProgressBar->new(@_);
-    $progress->minor(0);
-    $progress->max_update_rate(1);
+    my $progress = Time::Progress->new();
+    $progress->attr (@_);
     return $progress;
 
 }


More information about the svk-commit mailing list