Skip Menu |

This queue is for tickets about the Cvs CPAN distribution.

Report information
The Basics
Id: 31667
Status: new
Priority: 0/
Queue: Cvs

People
Owner: Nobody in particular
Requestors: matt [...] potosnak.net
Cc:
AdminCc:

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



Subject: Status Error
When a new file is the last file alphabetically in a directory, the next file status is listed in the wrong base directory. Attached patch fixes this, includes previous patches, and impliments cvs remove.
Subject: Cvs.diff.txt
diff -Naur Cvs-0.07/lib/Cvs/Command/Add.pm new/Cvs/Command/Add.pm --- Cvs-0.07/lib/Cvs/Command/Add.pm 1969-12-31 19:00:00.000000000 -0500 +++ new/Cvs/Command/Add.pm 2007-12-18 16:23:14.847753000 -0500 @@ -0,0 +1,87 @@ +package Cvs::Command::Add; + +use strict; +use Cvs::Result::Add; +use Cvs::Cvsroot; +use base qw(Cvs::Command::Base); + +use File::Type; + +sub init +{ + my($self, $file, $param) = @_; + $self->SUPER::init(@_) or return; + + $self->default_params + ( + 'binary' => 0, + ); + $self->param($param); + + return $self->error('Mandatory option: file') + unless(defined $file); + + $self->command('add'); + + # add '-kb' if the file is a binary + if ( $self->param->{'binary'} || isBinary( $self, $file ) ) { + $self->push_arg( '-kb' ); + } + $self->push_arg($file); + $self->go_into_workdir(1); + + my $result = new Cvs::Result::Add; + $self->result($result); + + my $main = $self->new_context(); + $self->initial_context($main); + + return $self; +} + +sub isBinary +{ + my( $self, $filename ) = @_; + my( @RETURN ); + + # fully qualify the filename + $filename = ( $self->cvs->working_directory() . '/' . $filename ); + + my( $ft ) = File::Type->new(); + + return( 0 ) unless ( -r $filename ); + my( $filetype ) = $ft->mime_type( $filename ); + + # if it's text/<whatever> or unidentifiable, return false; otherwise return true + unless ( ( $filetype =~ /^text\// ) || ( $filetype eq 'application/octet-stream' ) ) { + push( @RETURN, 1 ); + } + + return wantarray ? @RETURN : join( '', @RETURN ); + +} + +1; +=pod + +=head1 LICENCE + +This library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as +published by the Free Software Foundation; either version 2.1 of the +License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +USA + +=head1 COPYRIGHT + +Copyright (C) 2003 - Olivier Poitrey + diff -Naur Cvs-0.07/lib/Cvs/Command/Init.pm new/Cvs/Command/Init.pm --- Cvs-0.07/lib/Cvs/Command/Init.pm 1969-12-31 19:00:00.000000000 -0500 +++ new/Cvs/Command/Init.pm 2007-12-18 16:23:14.774546000 -0500 @@ -0,0 +1,54 @@ +package Cvs::Command::Init; + +use strict; +use Cvs::Result::Init; +use Cvs::Cvsroot; +use base qw(Cvs::Command::Base); + +sub init +{ + my($self, $param) = @_; + $self->SUPER::init(@_) or return; + + $self->default_params + ( + ); + $self->param($param); + + $self->command('init'); + + $self->go_into_workdir(1); + + my $result = new Cvs::Result::Init; + $self->result($result); + + my $main = $self->new_context(); + $self->initial_context($main); + + return $self; +} + +1; +=pod + +=head1 LICENCE + +This library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as +published by the Free Software Foundation; either version 2.1 of the +License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +USA + +=head1 COPYRIGHT + +Copyright (C) 2003 - Olivier Poitrey + diff -Naur Cvs-0.07/lib/Cvs/Command/Remove.pm new/Cvs/Command/Remove.pm --- Cvs-0.07/lib/Cvs/Command/Remove.pm 1969-12-31 19:00:00.000000000 -0500 +++ new/Cvs/Command/Remove.pm 2007-12-18 16:23:14.823064000 -0500 @@ -0,0 +1,62 @@ +package Cvs::Command::Remove; + +use strict; +use Cvs::Result::Remove; +use Cvs::Cvsroot; +use base qw(Cvs::Command::Base); + +use File::Type; + +sub init +{ + my($self, $file, $param) = @_; + $self->SUPER::init(@_) or return; + + $self->default_params + ( + 'binary' => 0, + ); + $self->param($param); + + return $self->error('Mandatory option: file') + unless(defined $file); + + $self->command('remove'); + + $self->push_arg($file); + $self->go_into_workdir(1); + + my $result = new Cvs::Result::Remove; + $self->result($result); + + my $main = $self->new_context(); + $self->initial_context($main); + + return $self; +} + + +1; +=pod + +=head1 LICENCE + +This library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as +published by the Free Software Foundation; either version 2.1 of the +License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +USA + +=head1 COPYRIGHT + +Copyright (C) 2003 - Olivier Poitrey + diff -Naur Cvs-0.07/lib/Cvs/Command/Status.pm new/Cvs/Command/Status.pm --- Cvs-0.07/lib/Cvs/Command/Status.pm 2004-04-02 02:56:32.000000000 -0500 +++ new/Cvs/Command/Status.pm 2007-12-18 16:23:14.788722000 -0500 @@ -31,6 +31,13 @@ my($resultlist, $current_directory); my $result = $self->err_result('No file in response'); + $main->push_handler + ( + qr/cvs (?:status|server): Examining (.*)\n$/, sub + { + $current_directory = shift->[1]; + } + ); $tags->push_handler ( qr/cvs (?:status|server): Examining (.*)\n$/, sub diff -Naur Cvs-0.07/lib/Cvs/Result/Add.pm new/Cvs/Result/Add.pm --- Cvs-0.07/lib/Cvs/Result/Add.pm 1969-12-31 19:00:00.000000000 -0500 +++ new/Cvs/Result/Add.pm 2007-12-18 16:23:14.692756000 -0500 @@ -0,0 +1,35 @@ +package Cvs::Result::Add; + +use strict; +use base qw(Cvs::Result::Base); + +sub init +{ + my $self = shift->SUPER::init(@_); + return $self; +} + +1; +=pod + +=head1 LICENCE + +This library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as +published by the Free Software Foundation; either version 2.1 of the +License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +USA + +=head1 COPYRIGHT + +Copyright (C) 2003 - Olivier Poitrey + diff -Naur Cvs-0.07/lib/Cvs/Result/Init.pm new/Cvs/Result/Init.pm --- Cvs-0.07/lib/Cvs/Result/Init.pm 1969-12-31 19:00:00.000000000 -0500 +++ new/Cvs/Result/Init.pm 2007-12-18 16:23:14.635365000 -0500 @@ -0,0 +1,35 @@ +package Cvs::Result::Init; + +use strict; +use base qw(Cvs::Result::Base); + +sub init +{ + my $self = shift->SUPER::init(@_); + return $self; +} + +1; +=pod + +=head1 LICENCE + +This library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as +published by the Free Software Foundation; either version 2.1 of the +License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +USA + +=head1 COPYRIGHT + +Copyright (C) 2003 - Olivier Poitrey + diff -Naur Cvs-0.07/lib/Cvs/Result/Remove.pm new/Cvs/Result/Remove.pm --- Cvs-0.07/lib/Cvs/Result/Remove.pm 1969-12-31 19:00:00.000000000 -0500 +++ new/Cvs/Result/Remove.pm 2007-12-18 16:23:14.660948000 -0500 @@ -0,0 +1,35 @@ +package Cvs::Result::Remove; + +use strict; +use base qw(Cvs::Result::Base); + +sub init +{ + my $self = shift->SUPER::init(@_); + return $self; +} + +1; +=pod + +=head1 LICENCE + +This library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as +published by the Free Software Foundation; either version 2.1 of the +License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +USA + +=head1 COPYRIGHT + +Copyright (C) 2003 - Olivier Poitrey + diff -Naur Cvs-0.07/lib/Cvs.pm new/Cvs.pm --- Cvs-0.07/lib/Cvs.pm 2004-12-08 10:03:26.000000000 -0500 +++ new/Cvs.pm 2007-12-18 16:23:32.377340000 -0500 @@ -117,6 +117,19 @@ L<Cvs::Result::Checkout>. +=head2 add + + Cvs::Result::Add = $cvs->add( $filename, { 'binary' => 1 } ); + +Adds the specified file to the CVS repository specified in the Cvs object. + +Cvs::Command::Add uses the L<File::Type> module to guess whether the specified file should +be checked in as a text file or a binary file; however, if desired, you can override this +autodetection by passing a true or false value to the C<binary> parameter. The default +value of C<binary> is false. + +L<Cvs::Result::Add>. + =head2 update Cvs::Result::Update = $cvs->update();