Skip Menu |

This queue is for tickets about the SVN-Pusher CPAN distribution.

Report information
The Basics
Id: 29838
Status: resolved
Worked: 20 min
Priority: 0/
Queue: SVN-Pusher

People
Owner: SHLOMIF [...] cpan.org
Requestors: dexter [...] debian.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.04
Fixed in: (no value)



Subject: Please, be less verbose as default
The SVN::Pusher is really great tool but I don't like its verbose messages. It is really hard to read the log message. Revision numbers of current operation just disappears quickly from terminal. I think the verbose messages should be not enabled by default (i.e. see svn log --verbose) Also I'd like to see a single space (perhaps 4 space characters as like "svk log -v") before character reporting the action taken. BTW, this output is very similar to svn log rather than to svn up, so I think the status "U" should be replaced with status "M" but it is not so important. Thank you.
Subject: SVN-Pusher-0.05.diff
diff -ru SVN-Pusher-0.04-R2czaL/bin/svn-pusher SVN-Pusher-0.05/bin/svn-pusher --- SVN-Pusher-0.04-R2czaL/bin/svn-pusher 2007-10-06 18:07:10.000000000 +0200 +++ SVN-Pusher-0.05/bin/svn-pusher 2007-10-08 13:58:45.000000000 +0200 @@ -53,6 +53,10 @@ Do not store uuid and timestamp in log message. +=item -v --verbose + +Print extra information. + =back Example: @@ -73,12 +77,12 @@ # -------------------------------------------------------------------------- -sub opt_push { return ('message|m:s', 'revision|r:s', 'savedate', 'verbatim') } +sub opt_push { return ('message|m:s', 'revision|r:s', 'savedate', 'verbatim', 'verbose|v') } sub do_push { - die "$0 push [--message=<text>] [--revision=<from>:<to>] [--savedate] [--verbatim] <source> <target>\n" unless $#_ >= 2; + die "$0 push [--message=<text>] [--revision=<from>:<to>] [--savedate] [--verbatim] [--verbose] <source> <target>\n" unless $#_ >= 2; my ($options, $source, $target) = @_; my %revs ; @@ -99,6 +103,7 @@ logmsg => $options -> {message}, savedate => $options -> {savedate}, verbatim => $options -> {verbatim}, + verbose => $options -> {verbose}, ); if ($m->init () > 0) Tylko w SVN-Pusher-0.05: blib diff -ru SVN-Pusher-0.04-R2czaL/CHANGES SVN-Pusher-0.05/CHANGES --- SVN-Pusher-0.04-R2czaL/CHANGES 2007-10-06 18:26:33.000000000 +0200 +++ SVN-Pusher-0.05/CHANGES 2007-10-08 13:54:47.000000000 +0200 @@ -1,5 +1,8 @@ SVN::Pusher changelog: +* 0.05 + - Added the --verbose flag. The default mode is more quiet. + * 0.04 Sat Oct 6 18:26:23 IST 2007 - Added the --savedate flag. (thanks to DEXTER) - Added the --verbatim flag. (thanks to DEXTER) diff -ru SVN-Pusher-0.04-R2czaL/lib/SVN/Pusher/CmdLine.pm SVN-Pusher-0.05/lib/SVN/Pusher/CmdLine.pm --- SVN-Pusher-0.04-R2czaL/lib/SVN/Pusher/CmdLine.pm 2007-10-06 17:35:56.000000000 +0200 +++ SVN-Pusher-0.05/lib/SVN/Pusher/CmdLine.pm 2007-10-08 14:10:34.000000000 +0200 @@ -11,7 +11,7 @@ if ($op eq "file") { - print sprintf("%-3c%s\n", ord($spec->{'file_op'}), $spec->{'path'}); + print sprintf(" %c %s\n", ord($spec->{'file_op'}), $spec->{'path'}); } elsif ($op eq "msg") { diff -ru SVN-Pusher-0.04-R2czaL/lib/SVN/Pusher.pm SVN-Pusher-0.05/lib/SVN/Pusher.pm --- SVN-Pusher-0.04-R2czaL/lib/SVN/Pusher.pm 2007-10-06 18:19:49.000000000 +0200 +++ SVN-Pusher-0.05/lib/SVN/Pusher.pm 2007-10-08 13:56:07.000000000 +0200 @@ -30,14 +30,14 @@ sub open_directory { my ($self,$path,$pb,undef,$pool) = @_; - $self->obj->report({'op' => "file", 'file_op' => "U", 'path' => $path}); + $self->obj->report({'op' => "file", 'file_op' => "M", 'path' => $path}) if $self->obj->{verbose}; return $self->SUPER::open_directory ($path, $pb, $self->{mirror}{target_headrev}, $pool); } sub open_file { my ($self,$path,$pb,undef,$pool) = @_; - $self->obj->report({'op' => "file", 'file_op' => "U", 'path' => $path}); + $self->obj->report({'op' => "file", 'file_op' => "M", 'path' => $path}) if $self->obj->{verbose}; $self->{opening} = $path; return $self->SUPER::open_file ($path, $pb, $self->{mirror}{target_headrev}, $pool); @@ -65,7 +65,7 @@ my $path = shift; my $pb = shift; my ($cp_path,$cp_rev,$pool) = @_; - $self->obj->report({'op' => "file", 'file_op' => "A", 'path' => $path}); + $self->obj->report({'op' => "file", 'file_op' => "A", 'path' => $path}) if $self->obj->{verbose}; $self->SUPER::add_directory($path, $pb, @_); } @@ -95,13 +95,13 @@ my $self = shift; my $path = shift; my $pb = shift; - $self->obj->report({'op' => "file", 'file_op' => "A", 'path' => $path}); + $self->obj->report({'op' => "file", 'file_op' => "A", 'path' => $path}) if $self->obj->{verbose}; $self->SUPER::add_file($path, $pb, @_); } sub delete_entry { my ($self, $path, $rev, $pb, $pool) = @_; - $self->obj->report({'op' => "file", 'file_op' => "D", 'path' => $path}); + $self->obj->report({'op' => "file", 'file_op' => "D", 'path' => $path}) if $self->obj->{verbose}; $self->SUPER::delete_entry ($path, $rev, $pb, $pool); } @@ -140,7 +140,7 @@ package SVN::Pusher ; -our $VERSION = '0.04'; +our $VERSION = '0.05'; use SVN::Core; use SVN::Repos; use SVN::Fs;
From: SHLOMIF [...] cpan.org
Hi DEXTER! Here are a few notes on your patch before I can apply it. Next time don't say "Please," in the subject. The correct subject should have been: <<<<<< [PATCH] Be Less Verbose By Default while adding a "--verbose" option Show quoted text
>>>>>>
And please do not reply to me in private but rather use rt.cpan.org to submit a reply. On Mon Oct 08 08:27:09 2007, DEXTER wrote: Show quoted text
> The SVN::Pusher is really great tool but I don't like its verbose > messages. It is really hard to read the log message. Revision
numbers Show quoted text
> of current operation just disappear quickly from terminal. > > I think the verbose messages should be not enabled by default (i.e. > see svn log --verbose) >
That sounds like a good idea. Here are some comments on your patch: <<<<<<<<<< diff -ru SVN-Pusher-0.04-R2czaL/bin/svn-pusher SVN-Pusher-0.05/bin/svn-pusher --- SVN-Pusher-0.04-R2czaL/bin/svn-pusher 2007-10-06 18:07:10.000000000 +0200 +++ SVN-Pusher-0.05/bin/svn-pusher 2007-10-08 13:58:45.000000000 +0200 Show quoted text
>>>>>>>>>
SVN-Pusher has an svn repository: http://svn.berlios.de/svnroot/repos/web-cpan/SVN-Pusher/trunk/ Please use it with "svn diff" to generate patches. <<<<<<<< sub do_push { - die "$0 push [--message=<text>] [--revision=<from>:<to>] [--savedate] [--verbatim] <source> <target>\n" unless $#_ >= 2; + die "$0 push [--message=<text>] [--revision=<from>:<to>] [--savedate] [--verbatim] [--verbose] <source> <target>\n" unless $#_ Show quoted text
>= 2;
my ($options, $source, $target) = @_; Show quoted text
>>>>>>>>>>>>>>
This line became two unwieldy for its own good. I can see several problems here: 1. The message should be split across several lines. 2. The "unless" should be converted to if (!). (see "Perl Best Practices") 3. Fix the trailing if to an "if (COND) { ... }" block. (Also see "Perl Best Practices"). <<<<<<<<<<<<<<< --- SVN-Pusher-0.04-R2czaL/CHANGES 2007-10-06 18:26:33.000000000 +0200 +++ SVN-Pusher-0.05/CHANGES 2007-10-08 13:54:47.000000000 +0200 @@ -1,5 +1,8 @@ SVN::Pusher changelog: +* 0.05 + - Added the --verbose flag. The default mode is more quiet. + * 0.04 Sat Oct 6 18:26:23 IST 2007 - Added the --savedate flag. (thanks to DEXTER) - Added the --verbatim flag. (thanks to DEXTER) Show quoted text
>>>>>>>>>>>>>>>>
Please don't add the version number to the CHANGES yet. <<<<<<<<<< sub open_directory { my ($self,$path,$pb,undef,$pool) = @_; - $self->obj->report({'op' => "file", 'file_op' => "U", 'path' => $path}); + $self->obj->report({'op' => "file", 'file_op' => "M", 'path' => $path}) if $self->obj->{verbose}; return $self->SUPER::open_directory ($path, $pb, $self->{mirror}{target_headrev}, $pool); } Show quoted text
>>>>>>>>>>>>
1. Avoid a trailing if. 2. You have the if ($self->obj->{verbose}) { $self->obj->report(...) } pattern several times. Please encapsulate it into its own method. <<<<<<<<<<<<<< -our $VERSION = '0.04'; +our $VERSION = '0.05'; Show quoted text
>>>>>>>>>>>>>>
Please don't increment the $VERSION with your patch. Let me do it, as I may wish to have some other changes. Regards, Shlomi Fish
From: piotr.roszatycki [...] gmail.com
Show quoted text
> Here are a few notes on your patch before I can apply it. Next time > don't say "Please," in the subject. The correct subject should have > been:
Sorry. I usually use Debian's Bug Tracking System which has more options like i.e. tags so I don't need to mark the patch in the subject and the subject can be modified at any time. Show quoted text
> And please do not reply to me in private but rather use rt.cpan.org
to Show quoted text
> submit a reply.
Another habit from Debian's BTS... Show quoted text
> This line became two unwieldy for its own good. I can see several > problems here:
It was intended to not change too much because I wanted to keep the simplicity of patch and didn't want to lose the idea and clarity of change. I know the "Perl Best Practices" and many of its advices are worth of using but my code is just a proof of concept, not the final solution. Show quoted text
> Please don't increment the $VERSION with your patch. Let me do it,
as Show quoted text
> I may wish to have some other changes.
I did the $VERSION incrementation and CHANGES entry because it is not original package already on my system. Even that I didn't release the modified module anywhere but this RT submit. You can do with this submit whatever you want. It is my proposition and if you feel it doesn't fit your needs or coding style, please drop it or change it or just tell me if you like it and I really modify it in more clean way. I didn't know that SVN::Pusher is hosted on Berlios. Next time I'll use its SVN repository. Thanks.
From: SHLOMIF [...] cpan.org
On Mon Oct 08 17:31:37 2007, DEXTER wrote: Show quoted text
> > Here are a few notes on your patch before I can apply it. Next
time Show quoted text
> > don't say "Please," in the subject. The correct subject should
have Show quoted text
> > been:
> > Sorry. I usually use Debian's Bug Tracking System which has more > options like i.e. tags so I don't need to mark the patch in the > subject and the subject can be modified at any time. >
OK. Show quoted text
> > And please do not reply to me in private but rather use
rt.cpan.org Show quoted text
> to
> > submit a reply.
> > Another habit from Debian's BTS... >
OK. Show quoted text
> > This line became two unwieldy for its own good. I can see several > > problems here:
> > It was intended to not change too much because I wanted to keep the > simplicity of patch and didn't want to lose the idea and clarity of > change. I know the "Perl Best Practices" and many of its advices are > worth of using but my code is just a proof of concept, not the final > solution.
OK, please fix it for the next incarnation of the patch. Show quoted text
>
> > Please don't increment the $VERSION with your patch. Let me do it,
> as
> > I may wish to have some other changes.
> > I did the $VERSION incrementation and CHANGES entry because it is
not Show quoted text
> original package already on my system. Even that I didn't release
the Show quoted text
> modified module anywhere but this RT submit.
OK, please avoid it next time. Show quoted text
> > You can do with this submit whatever you want. It is my proposition > and if you feel it doesn't fit your needs or coding style, please
drop Show quoted text
> it or change it or just tell me if you like it and I really modify
it Show quoted text
> in more clean way.
I like it. Please modify it according to my previous commentary. Show quoted text
> > I didn't know that SVN::Pusher is hosted on Berlios. Next time I'll > use its SVN repository. >
OK. Regards, Shlomi Fish Show quoted text
> Thanks.
Show quoted text
> I like it. Please modify it according to my previous commentary.
The cleaned up patch is attached. Greets.
=== bin/svn-pusher ================================================================== --- bin/svn-pusher (revision 2392) +++ bin/svn-pusher (local) @@ -53,6 +53,10 @@ Do not store uuid and timestamp in log message. +=item -v --verbose + +Print extra information. + =back Example: @@ -73,12 +77,22 @@ # -------------------------------------------------------------------------- -sub opt_push { return ('message|m:s', 'revision|r:s', 'savedate', 'verbatim') } +sub opt_push { + return qw{ + message|m:s + revision|r:s + savedate + verbatim + verbose|v + }; +} sub do_push { - die "$0 push [--message=<text>] [--revision=<from>:<to>] [--savedate] [--verbatim] <source> <target>\n" unless $#_ >= 2; + die "Not enough arguments provided; try 'svn-pusher help' for more info\n" + if (@_ < 2); + my ($options, $source, $target) = @_; my %revs ; @@ -99,6 +113,7 @@ logmsg => $options -> {message}, savedate => $options -> {savedate}, verbatim => $options -> {verbatim}, + verbose => $options -> {verbose}, ); if ($m->init () > 0) @@ -115,7 +130,7 @@ my $cmdsub = "do_$cmd" ; my $cmdopt = "opt_$cmd" ; -die "Command not recognized. Try $0 help\n" unless main->can($cmdsub); +die "Command not recognized. Try svn-pusher help\n" unless main->can($cmdsub); my %options ; if (my $cmdopt_ref = main -> can ($cmdopt)) === lib/SVN/Pusher/CmdLine.pm ================================================================== --- lib/SVN/Pusher/CmdLine.pm (revision 2392) +++ lib/SVN/Pusher/CmdLine.pm (local) @@ -11,7 +11,7 @@ if ($op eq "file") { - print sprintf("%-3c%s\n", ord($spec->{'file_op'}), $spec->{'path'}); + print sprintf(" %c %s\n", ord($spec->{'file_op'}), $spec->{'path'}); } elsif ($op eq "msg") { === lib/SVN/Pusher.pm ================================================================== --- lib/SVN/Pusher.pm (revision 2392) +++ lib/SVN/Pusher.pm (local) @@ -30,14 +30,14 @@ sub open_directory { my ($self,$path,$pb,undef,$pool) = @_; - $self->obj->report({'op' => "file", 'file_op' => "U", 'path' => $path}); + $self->obj->report_file($path, 'M'); return $self->SUPER::open_directory ($path, $pb, $self->{mirror}{target_headrev}, $pool); } sub open_file { my ($self,$path,$pb,undef,$pool) = @_; - $self->obj->report({'op' => "file", 'file_op' => "U", 'path' => $path}); + $self->obj->report_file($path, 'M'); $self->{opening} = $path; return $self->SUPER::open_file ($path, $pb, $self->{mirror}{target_headrev}, $pool); @@ -65,7 +65,7 @@ my $path = shift; my $pb = shift; my ($cp_path,$cp_rev,$pool) = @_; - $self->obj->report({'op' => "file", 'file_op' => "A", 'path' => $path}); + $self->obj->report_file($path, 'A'); $self->SUPER::add_directory($path, $pb, @_); } @@ -95,13 +95,13 @@ my $self = shift; my $path = shift; my $pb = shift; - $self->obj->report({'op' => "file", 'file_op' => "A", 'path' => $path}); + $self->obj->report_file($path, 'A'); $self->SUPER::add_file($path, $pb, @_); } sub delete_entry { my ($self, $path, $rev, $pb, $pool) = @_; - $self->obj->report({'op' => "file", 'file_op' => "D", 'path' => $path}); + $self->obj->report_file($path, 'D'); $self->SUPER::delete_entry ($path, $rev, $pb, $pool); } @@ -192,6 +192,13 @@ return $self->report({'op' => 'msg', 'msg' => $msg }); } +sub report_file { + my ($self, $path, $op) = @_; + if ($self->{verbose}) { + $self->report({'op' => "file", 'file_op' => $op, 'path' => $path}); + } +} + sub committed { my ($self, $date, $sourcerev, $rev, undef, undef, $pool) = @_; my $cpool = SVN::Pool->new_default ($pool); @@ -233,8 +240,8 @@ my $editor = SVN::Pusher::MirrorEditor->new ($tra->get_commit_editor( $self->{verbatim} - ? "$msg" - : ( ($msg?"$msg\n":'') . ":$rev:$self->{source_uuid}:$date:" ) + ? (defined $msg ? "$msg" : '') + : ( (defined $msg ? "$msg\n" : '') . ":$rev:$self->{source_uuid}:$date:" ) , sub { $self->committed($date, $rev, @_) }, undef, 0));
From: SHLOMIF [...] cpan.org
On Thu Oct 11 08:40:02 2007, DEXTER wrote: Show quoted text
> > I like it. Please modify it according to my previous commentary.
> > The cleaned up patch is attached. Greets.
Here are some further comments on it: <<<<<<<<<<< - die "$0 push [--message=<text>] [--revision=<from>:<to>] [--savedate] [--verbatim] <source> <target>\n" unless $#_ >= 2; + die "Not enough arguments provided; try 'svn-pusher help' for more info\n" + if (@_ < 2); + Show quoted text
>>>>>>>>>>>
Use "$0" instead of "svn-pusher". I suppose I can fix the trailing conditional in a different commit. <<<<<<<< -die "Command not recognized. Try $0 help\n" unless main->can($cmdsub); +die "Command not recognized. Try svn-pusher help\n" unless main->can($cmdsub); Show quoted text
>>>>>>>>
Again - "$0" instead of "svn-pusher" <<<<<<<<<< +sub report_file { + my ($self, $path, $op) = @_; + if ($self->{verbose}) { + $self->report({'op' => "file", 'file_op' => $op, 'path' => $path}); + } +} + Show quoted text
>>>>>>>>>
That's a good change. Thanks. <<<<<<<<<<<< my $editor = SVN::Pusher::MirrorEditor->new ($tra->get_commit_editor( $self->{verbatim} - ? "$msg" - : ( ($msg?"$msg\n":'') . ":$rev:$self->{source_uuid}: $date:" ) + ? (defined $msg ? "$msg" : '') + : ( (defined $msg ? "$msg\n" : '') . ":$rev: $self->{source_uuid}:$date:" ) , sub { $self->committed($date, $rev, @_) }, undef, 0)); Show quoted text
>>>>>>>>>>>>>>
You can rewrite this as: <<<<<<<< $dmsg = defined($msg) ? ( $msg . ($self->{verbatim} ? "" : "\n") ) : ''; $tra->get_commit_editor( $dmsg . ($self->{verbatim} ? "" : ":$rev:$self->{source_uuid}:$date:" ), . . . ) Show quoted text
>>>>>>>>>>
This will help avoid this syndrome: http://worsethanfailure.com/Articles/Turn_it_up_to_Eleven.aspx And eliminate some duplicate code.
From: piotr.roszatycki [...] gmail.com
On Czw. 11 Paź. 2007, 15:03:14, SHLOMIF wrote: Show quoted text
> <<<<<<<<<<< > - die "$0 push [--message=<text>] [--revision=<from>:<to>] > [--savedate] [--verbatim] <source> <target>\n" unless $#_ >= 2; > + die "Not enough arguments provided; try 'svn-pusher help' for > more info\n" > + if (@_ < 2); > +
> >>>>>>>>>>>
> > Use "$0" instead of "svn-pusher". I suppose I can fix the trailing > conditional in a different commit.
The trailing conditional (I suppose you mean postfix if?) is perfectly correct for flow control structures. See PBP Page 94. IMO, the message like (the real one): Not enough arguments provided; try '/var/lib/gforge/chroot/home/users/dexter/perl/bin/svn-pusher help is just horrible. Do as you like. It's not so important for me. Show quoted text
> <<<<<<<<<<<< > my $editor = SVN::Pusher::MirrorEditor->new > ($tra->get_commit_editor( > $self->{verbatim} > - ? "$msg" > - : ( ($msg?"$msg\n":'') . ":$rev:$self->{source_uuid}: > $date:" ) > + ? (defined $msg ? "$msg" : '') > + : ( (defined $msg ? "$msg\n" : '') . ":$rev: > $self->{source_uuid}:$date:" ) > , > sub { $self->committed($date, $rev, @_) }, > undef, 0));
> >>>>>>>>>>>>>>
> > You can rewrite this as:
Yes, this is ugly and I rather avoid such code in my projects :) Do you apply your modified version? I'm waiting for next release of SVN::Pusher. I'd like to package it for Debian distribution. See: http://bugs.debian.org/446255 Thanks for a good work.
From: SHLOMIF [...] cpan.org
On Thu Oct 11 15:55:03 2007, DEXTER wrote: Show quoted text
> On Czw. 11 Paź. 2007, 15:03:14, SHLOMIF wrote:
> > <<<<<<<<<<< > > - die "$0 push [--message=<text>] [--revision=<from>:<to>] > > [--savedate] [--verbatim] <source> <target>\n" unless $#_ >= 2; > > + die "Not enough arguments provided; try 'svn-pusher help' for > > more info\n" > > + if (@_ < 2); > > +
> > >>>>>>>>>>>
> > > > Use "$0" instead of "svn-pusher". I suppose I can fix the trailing > > conditional in a different commit.
> > The trailing conditional (I suppose you mean postfix if?)
Yes, that's what I meant. Show quoted text
> is perfectly > correct for flow control structures. See PBP Page 94. >
Whatever PBP says I'm not fond of it at all, and would rather avoid it. I corrected it manually. Show quoted text
> IMO, the message like (the real one): > > Not enough arguments provided; > try '/var/lib/gforge/chroot/home/users/dexter/perl/bin/svn-pusher
help Show quoted text
> > is just horrible. Do as you like. It's not so important for me. >
OK. The point of $0 is to make sure the user can run the command, and that the correct path will be displayed. Normally you should put svn-pusher in the path. Show quoted text
> > <<<<<<<<<<<< > > my $editor = SVN::Pusher::MirrorEditor->new > > ($tra->get_commit_editor( > > $self->{verbatim} > > - ? "$msg" > > - : ( ($msg?"$msg\n":'') . ":$rev:$self->{source_uuid}: > > $date:" ) > > + ? (defined $msg ? "$msg" : '') > > + : ( (defined $msg ? "$msg\n" : '') . ":$rev: > > $self->{source_uuid}:$date:" ) > > , > > sub { $self->committed($date, $rev, @_) }, > > undef, 0));
> > >>>>>>>>>>>>>>
> > > > You can rewrite this as:
> > Yes, this is ugly and I rather avoid such code in my projects :) Do > you apply your modified version?
I applied it. Show quoted text
> > I'm waiting for next release of SVN::Pusher.
It's released now. Show quoted text
> I'd like to package it > for Debian distribution. See: http://bugs.debian.org/446255 >
OK. That would be nice. Show quoted text
> Thanks for a good work.
You're welcome. Regards, Shlomi Fish
Patch was applied and modified and a new version of SVN::Pusher - 0.05 was released to the CPAN. Regards, Shlomi Fish