OSSP CVS Repository

ossp - Check-in [4578]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 4578
Date: 2004-May-10 19:57:48 (local)
2004-May-10 17:57:48 (UTC)
User:rse
Branch:
Comment: Optimize and bugfix the determination of the number of lines in case of added files.

This especially fixes the following error:

| Use of uninitialized value in <HANDLE> at /e/openpkg/cvs/CVSROOT/shiela line 1679. | readline() on unopened filehandle at /e/openpkg/cvs/CVSROOT/shiela line 1679. | cvs:shiela::ERROR: Can't call method "close" on an undefined value (No such file or directory)

Tickets:
Inspections:
Files:
ossp-pkg/shiela/ChangeLog      1.45 -> 1.46     6 inserted, 0 deleted
ossp-pkg/shiela/shiela.pl      1.57 -> 1.58     13 inserted, 7 deleted

ossp-pkg/shiela/ChangeLog 1.45 -> 1.46

--- ChangeLog    2004/05/10 13:38:24     1.45
+++ ChangeLog    2004/05/10 17:57:48     1.46
@@ -9,6 +9,12 @@
 
   ChangeLog
 
+  Changes between 1.1.1 and 1.1.2 (10-May-2002 to 10-May-2004):
+
+   *) Optimize and bugfix the determination of the number of
+      lines in case of added files.
+      [Ralf S. Engelschall]
+
   Changes between 1.1.0 and 1.1.1 (07-May-2002 to 10-May-2004):
 
    *) Workaround a syntax problem under Solaris /bin/sh.


ossp-pkg/shiela/shiela.pl 1.57 -> 1.58

--- shiela.pl    2004/05/10 17:54:05     1.57
+++ shiela.pl    2004/05/10 17:57:48     1.58
@@ -1674,11 +1674,8 @@
         }
         else {
             if ($Io eq 'A') {
-                my $io = new IO::File "<$Is" || die "unable to open $Is for reading";
-                my $l = 0;
-                $l++ while (<$io>);
-                $io->close;
-                $Id = sprintf("+%d/-%d", $l, 0);
+                #   determined later below when we have to read in the
+                #   whole content anyway in order to create the difference.
             }
             elsif ($Io eq 'M') {
                 if ($rcslog =~ m|\ndate:.*lines:\s*([\d \t+-]+)|s) {
@@ -1710,10 +1707,14 @@
             unlink("$RT->{tmpfile}.all");
             my $io = new IO::File ">$RT->{tmpfile}.all"
                 || die "unable to open temporary file $RT->{tmpfile}.all for writing";
+            my $l = 0;
             if (not $RT->{useserver}) {
                 my $cvs = new IO::File "$RT->{cvs} -f -Q -n update -p -r$Iv '$Is'|"
                     || die "unable to open CVS command pipe for reading";
-                $io->print($_) while (<$cvs>);
+                while (<$cvs>) {
+                    $io->print($_);
+                    $l++;
+                }
                 $cvs->close;
             }
             else {
@@ -1722,9 +1723,14 @@
                 $cvs->entry($Is);
                 $cvs->arguments("-p", "-r$Iv", $Is);
                 $cvs->send("update");
-                $io->print(scalar $cvs->result);
+                my $r = scalar $cvs->result;
+                $io->print($r);
                 $cvs->close;
+                if ($r ne '') {
+                    $l++ while ($r =~ m/^/mg);
+                }
             }
+            $Id = sprintf("+%d/-%d", $l, 0) if ($Ik eq 'b' or -B $Is);
             $io->close;
 
             if ($Ik eq 'b' or -B $Is) {

CVSTrac 2.0.1