In trunk I believe that retriving logs and revisions are pipelined (or will be soon). That something you might want to take into consideration, since you'd have to update 2 status lines at once. Pehaps the status for logs and commits can be folded into one line somehow. Something like this might work I suppose (though the wording could be changed):
<br><br>Syncing from <a href="file://localhost/home/jon/test_parrot">file://localhost/home/jon/test_parrot</a><br>
Metadata 50% (5032/10456) data 25% (2541/10436)<br>
<br>
Michael<br><br><div><span class="gmail_quote">On 12/18/06, <b class="gmail_sendername">Jonathan Rockway</b> <<a href="mailto:jon@jrock.us">jon@jrock.us</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I tried git for the first time this weekend, and while I won't be<br>switching from svk to git any time soon, I did like the progress<br>indication that's output during "git clone". So, I've added it to<br>SVN::Mirror (patch on RT), and SVK::Mirror in trunk of svk.
<br></blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Instead of:<br> svk sync //test_parrot/mirror<br> Syncing <a href="file://localhost/home/jon/test_parrot">
file://localhost/home/jon/test_parrot</a><br> Retrieving log information from 106 to 10561<br> <really long wait with no feedback><br> Committed revision 107 from 106<br> Committed revision 108 from 107<br> <snip 10000 lines of useless information>
<br><br>You get:<br> Syncing <a href="file://localhost/home/jon/test_parrot">file://localhost/home/jon/test_parrot</a><br> Retrieving log information from 106 to 10561<br> 100% (10456/10456)<br> Downloading revision information...
<br> 29% (3070/10456)<br><br>My patch isn't without problems, though. The tests that expect<br>"Committed ## from ##" all fail, obviously, since that's not printed<br>anymore. I'd like to somehow add a log level called "progress" and then
<br>let the user pick whether he wants the verbose information, or if he<br>wants a nice progress bar instead. (people running pullmi [or is that<br>pushyu; i'm confused] will not want the progress bar, for example). I'm
<br>not sure how to best do this, though.<br><br>Also, the callback that prints the progress meter after "Downloading<br>revision number" can't currently get at $torev if it's "HEAD", so I<br>added a nasty hack to change that. However, it can easily be made less
<br>nasty if this is the best way to do it (add a torev accessor, and then<br>pass it to the callback as my patch does, sort of).<br><br>Finally, the "Retrieving log information from 1 to 10561<br> 100% (10561/10561)
<br>Downloading revision information..." part is specific to the RA backend,<br>which seems non-optimal to me (but I can live with it for now, because<br>it's the only backend).<br><br>Anyway, suggestions welcome. If people like this, I'm going to add the
<br>same thing to checkout (for the initial checkout), because nobody ever<br>reads the list of files from svk checkout anyway (but they do want to<br>know how long it's going to take). After that's done, I plan to add a
<br>"clone" operation, so you can write:<br><br>$ svk clone <a href="http://svn.somewhere.com/repos/foo">http://svn.somewhere.com/repos/foo</a><br><br>and have svk do:<br> svk mirror //mirror/foo <a href="http://svn.somewhere.com/repos/foo">
http://svn.somewhere.com/repos/foo</a><br> svk sync //mirror/foo<br> svk copy //mirror/foo //local/foo<br> svk co //local/foo<br><br>The output will look like:<br><br>Syncing <a href="http://svn.somewhere.com/repos/foo">http://svn.somewhere.com/repos/foo
</a><br>Mirroring <a href="http://svn.somewhere.com/repos/foo">http://svn.somewhere.com/repos/foo</a> to //mirror/foo<br>Retrieving log information from 1 to 10561<br> 100% (10561/10561)<br>Downloading revision information...
<br> 100% (10561/10561)<br>Creating local branch...<br>Checking out a working copy...<br> 100% (1234/1234)<br>$ cd foo<br>$ # start your work<br><br>Yes, this is completely stolen from git, but it's a good idea :)<br>Comments welcome (especially about the //mirror and //local naming
<br>conventions) before I start hacking on this.<br><br>Regards,<br>Jonathan Rockway<br><br>--<br>package JAPH;use Catalyst qw/-Debug/;($;=JAPH)->config(name => do {<br>$,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
<br>";$;"]->[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;->setup;<br><br><br>==== Patch <svk_sync_progress> level 2<br>Source: d7608cd0-831c-0410-93c0-e5b306c3c028:/local/svk:13011<br>Target: 4ccb8a5b-8ae0-0310-9b02-86531366991d:/:2240
<br> (<a href="http://code.bestpractical.com/svk">http://code.bestpractical.com/svk</a>)<br>Log:<br> r12556@foo: jon | 2006-12-16 19:20:44 -0600<br> local branch of svk<br> r13010@foo: jon | 2006-12-18 14:49:19 -0600
<br> added progress bar for svn sync; both log info and revision commits<br> r13011@foo: jon | 2006-12-18 16:04:35 -0600<br> sync meter off-by-one, and also off-by-looking-at-the-wrong-counter. fixed.<br><br>=== trunk/lib/SVK/Mirror.pm
<br>==================================================================<br>--- trunk/lib/SVK/Mirror.pm (revision 2240)<br>+++ trunk/lib/SVK/Mirror.pm (patch svk_sync_progress level 2)<br>@@ -363,15 +363,27 @@<br><br>
$logger->info(loc("Syncing %1", $self->url).($self->_backend->_relayed ? loc(" via %1", $self->server_url) : ""));<br><br>+ my $fromrev = $self->fromrev;<br>+ $self->_show_progress(0, $torev-$fromrev+1) if $torev;
<br> $self->mirror_changesets($torev,<br> sub {<br>- my ( $changeset, $rev ) = @_;<br>- $logger->info("Committed revision $rev from revision $changeset.");<br>+ my ( $changeset, $rev, $torev ) = @_;
<br>+ #$logger->info("Committed revision $rev from revision $changeset.");<br>+ $self->_show_progress($changeset-$fromrev, $torev-$fromrev);<br> }<br> );<br>+ print "\n";
<br> die $@ if $@;<br> }<br><br>+sub _show_progress {<br>+ my $self = shift;<br>+ my ($current, $to) = @_;<br>+ local $| = 1;<br>+ $to ||= 1;<br>+ printf " %3d%% (%d/%d)\r", int(100*$current/$to), $current, $to;
<br>+}<br>+<br> sub sync_snapshot {<br> my ($self, $snapshot) = @_;<br> $logger->warn(loc("<br>=== trunk/lib/SVK/Mirror/Backend/SVNRa.pm<br>==================================================================
<br>--- trunk/lib/SVK/Mirror/Backend/SVNRa.pm (revision 2240)<br>+++ trunk/lib/SVK/Mirror/Backend/SVNRa.pm (patch svk_sync_progress level 2)<br>@@ -287,7 +287,7 @@<br><br> my $err;<br> {<br>- local $SVN::Error::handler = sub { $err = $_[0]; die \'error handled' };
<br>+ local $SVN::Error::handler = sub { $err = $_[0]; die \'error handled' }; #'}; # pacify emacs<br> if ( eval { $ra->replay( 0, 0, 0, SVK::Editor->new ); 1 } ) {<br> $self->_ra_finished($ra);
<br> return $self->_has_replay(1);<br>@@ -408,15 +408,19 @@<br> my $ra = $self->_new_ra;<br> $to = $ra->get_latest_revnum() if $to == -1;<br> return if $from > $to;<br>+ $self->{torev} = $to; # XXX hack
<br> print "Retrieving log information from $from to $to\n";<br>+ $self->mirror->_show_progress(0, $to-$from+1);<br> eval {<br> $ra->get_log([''], $from, $to, 0,<br> 0, 1,
<br> sub {<br> my ($paths, $rev, $author, $date, $msg, $pool) = @_;<br> $code->($rev, { author => $author, date => $date, message => $msg });<br>+ $self->mirror->_show_progress($rev-$from+1,$to-$from+1);
<br> });<br> };<br>+ print "\n";<br> $self->_ra_finished($ra);<br> die $@ if $@;<br> }<br>@@ -436,7 +440,9 @@<br> $t->repos->fs->change_rev_prop( $_[0], 'svn:date',
<br> $metadata->{date} );<br> $self->fromrev( $_[0] );<br>- $callback->( $changeset, $_[0] ) if $callback;<br>+<br>+ # XXX: torev is a hack<br>+ $callback->( $changeset, $_[0], $self->{torev} ) if $callback;
<br> }<br> );<br><br>@@ -536,6 +542,7 @@<br> $self->refresh;<br> my @revs;<br> $self->traverse_new_changesets( sub { push @revs, [@_] }, $torev );<br>+ $torev = $self->{torev}; # XXX do this more cleanly
<br> return unless @revs;<br><br> # prepare generator for pipelined ra<br>@@ -550,6 +557,7 @@<br> }<br> $ra = SVK::Mirror::Backend::SVNRaPipe->new( $ra, sub { shift @gen } );<br> }<br>+ print "Downloading revision information...\n";
<br> my $pool = SVN::Pool->new_default;<br> for (@revs) {<br> $pool->clear;<br><br>==== BEGIN SVK PATCH BLOCK ====<br>Version: svk 1.99_05 (linux)<br><br>eJyNVt2O20QUzgUXECGeAKRh68AujZMZ/9tRo4ifvQEqVEpVtUXR2B4npo4nGju7jeqVdtUKCW64
<br>6QVPwQ2v0Ct4BFRueAkkbjgzsb3ZJdvFipSZM+d858fnO55DcXc0IdV4jCuN4Orre58HwVe0jOY9<br>YlWaU7E4LbnQ7CpjR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au6cXKaQ4mjNeZlc
<br>gDbTIC0QPU+0eTQgQxaCVB9fmiTTh/jbPrpYtXqw3LokbsoYc1TOwc8CpCjKGM2zdR3Yp/w4zziN<br>ZUnb6bJV18FgIAu5kzyqY1hsY5+Enstc308odgmJbMPGxCeObarvuqGZ2KmQkO3pTBLOA4S+AzcV<br>MjB2dGLoxEHEDwwcWBbSsYNxtx4HoaB5NEc8QcURFEjIrz/eDeEhYgWWHxC/gaBxDGO0nUwhFQjy
<br>AqQcFes8GqGQl/O2kRDNt2ZupMZwUbskV7p0AmwFpt24lLhowUomIOZED9c6z1lfQdOs4I0w4/wx<br>VFynpV7OmX4sOGwivsrBcIBQkj5h8aCrEbeCtKcStO2/8dioNMPY3KzuqutREHyTp0dMFDTrORVc<br>zpa0nMNNDZKBzWqVxvLVDVVFhwDY3KI006li18FeFGPdM0mkY4tg3TcjrDM7hJcWwdLwxgdGdSVw
<br>NYSlYVhYolkwMj1qh7pHGdaxKdFCbOgetAIxHcf3SazZ5v/yGpwHHKhw/wXQ/1d9<br>==== END SVK PATCH BLOCK ====<br><br><br>_______________________________________________<br>svk-devel mailing list<br><a href="mailto:svk-devel@bestpractical.com">
svk-devel@bestpractical.com</a><br><a href="http://lists.bestpractical.com/cgi-bin/mailman/listinfo/svk-devel">http://lists.bestpractical.com/cgi-bin/mailman/listinfo/svk-devel</a><br><br><br></blockquote></div><br>