Skip Menu |

This queue is for tickets about the Dist-Zilla-Plugin-Mercurial CPAN distribution.

Report information
The Basics
Id: 105188
Status: resolved
Priority: 0/
Queue: Dist-Zilla-Plugin-Mercurial

People
Owner: Nobody in particular
Requestors: VDB [...] cpan.org
Cc:
AdminCc:

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



Subject: If someting wrong with hg, Mercurial::Check continues
I have line "[Mercurial::Check]" in my dist.ini. This plugin runs "hg" in order to check if there are any changed and non-yet-committed files. However, in case of any troubles, for example: "hg" command is not available, or no ".hg" directory found, error message it printed to the screen, but execution continues. Such behavior is not acceptable. Reason for such behaviour is using backtics: `hg branch`, `hg status`. I would recommend using IPC::System::Simple, capture() instead. This plugin already has dependency on IPC::System::Simple, so no new dependecies will be introduced. Patch: --- lib/Dist/Zilla/Plugin/Mercurial/Check.pm.ORIG 2015-06-12 13:20:12.000000000 +0300 +++ lib/Dist/Zilla/Plugin/Mercurial/Check.pm 2015-06-12 13:20:37.807547646 +0300 @@ -4,16 +4,17 @@ use warnings; use Moose; +use IPC::System::Simple 'capture'; with 'Dist::Zilla::Role::BeforeRelease'; sub before_release { my $self = shift; - my $branch = `hg branch`; + my $branch = capture( 'hg', 'branch' ); chomp $branch; - if ( my @output = `hg status` ) { + if ( my @output = capture( 'hg', 'status' ) ) { my $errmsg = "This branch ($branch) has some files that are not yet committed:\n" . join q{}, map {"\t$_"} @output;
Hi VDB, thanks for the report and the patch. This should now be fixed in version 0.08 of Dist-Zilla-Plugin-Mercurial . Regards, -- Shlomi Fish On Fri Jun 12 06:27:50 2015, VDB wrote: Show quoted text
> I have line "[Mercurial::Check]" in my dist.ini. This plugin runs "hg" > in order to check if there are any changed and non-yet-committed > files. However, in case of any troubles, for example: "hg" command is > not available, or no ".hg" directory found, error message it printed > to the screen, but execution continues. Such behavior is not > acceptable. > > Reason for such behaviour is using backtics: `hg branch`, `hg status`. > > I would recommend using IPC::System::Simple, capture() instead. This > plugin already has dependency on IPC::System::Simple, so no new > dependecies will be introduced. > > Patch: > > --- lib/Dist/Zilla/Plugin/Mercurial/Check.pm.ORIG 2015-06-12 > 13:20:12.000000000 +0300 > +++ lib/Dist/Zilla/Plugin/Mercurial/Check.pm 2015-06-12 > 13:20:37.807547646 +0300 > @@ -4,16 +4,17 @@ > use warnings; > > use Moose; > +use IPC::System::Simple 'capture'; > > with 'Dist::Zilla::Role::BeforeRelease'; > > sub before_release { > my $self = shift; > > - my $branch = `hg branch`; > + my $branch = capture( 'hg', 'branch' ); > chomp $branch; > > - if ( my @output = `hg status` ) { > + if ( my @output = capture( 'hg', 'status' ) ) { > my $errmsg > = "This branch ($branch) has some files that are not yet > committed:\n" > . join q{}, map {"\t$_"} @output; > > >