OSSP CVS Repository

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

Check-in Number: 3006
Date: 2002-Dec-21 18:02:59 (local)
2002-Dec-21 17:02:59 (UTC)
User:rse
Branch:
Comment: provide revision number also for removed files
Tickets:
Inspections:
Files:
ossp-pkg/shiela/shiela.pl      1.26 -> 1.27     41 inserted, 11 deleted

ossp-pkg/shiela/shiela.pl 1.26 -> 1.27

--- shiela.pl    2002/12/21 12:38:55     1.26
+++ shiela.pl    2002/12/21 17:02:59     1.27
@@ -1539,9 +1539,34 @@
         #   fix branch/tag and accumulate information
         $It = 'HEAD' if ($It eq '');
 
+        #   manually determine next revision number for removed files
+        #   by fetching the whole revision log and extracting the next
+        #   number.
+        if ($Io eq 'R' and $Iv eq 'NONE') {
+            my $rcslog ='';
+            if (not $RT->{useserver}) {
+                my $io = new IO::File "$RT->{cvs} -f -l -Q -n log '$Is'|"
+                    || die "unable to open CVS command pipe for reading";
+                $rcslog .= $_ while (<$io>);
+                $io->close;
+            }
+            else {
+                my $cvs = new CVS ($RT->{cvs}, $RT->{cvsroot});
+                $cvs->directory($cvsdir);
+                $cvs->entry($Is);
+                $cvs->arguments($Is);
+                $cvs->send("log");
+                $rcslog = scalar $cvs->result;
+                $cvs->close;
+            }
+            if ($rcslog =~ m|^head:\s+([\d.]+)|m) {
+                $Iv = $1;
+            }
+        }
+
         #   read file log entry   
         my $rcslog = '';
-        if ($Io eq 'A' or $Io eq 'M') {
+        if ($Io eq 'A' or $Io eq 'M' or $Io eq 'R') {
             if (not $RT->{useserver}) {
                 my $io = new IO::File "$RT->{cvs} -f -l -Q -n log -r$Iv '$Is'|"
                     || die "unable to open CVS command pipe for reading";
@@ -1719,11 +1744,21 @@
                 $d =~ s|^(\+\+\+\s+)${Is_quoted}(\s+)|$1$cvsdir/$Is$2|m;
                 $cvsdiff .=
                     "<Diff $cvsdir/$Is>\n" .
-                     "Index: $cvsdir/$Is\n" .
-                     "============================================================\n" .
-                     "\$ cvs diff -u -r$IV -r$Iv $Is\n" .
-                     $d .
-                     "</Diff>\n";
+                    "Index: $cvsdir/$Is\n" .
+                    "============================================================\n" .
+                    "\$ cvs diff -u -r$IV -r$Iv $Is\n" .
+                    $d .
+                    "</Diff>\n";
+            }
+        }
+        elsif ($Io eq 'R') {
+            if ($Ik eq 'b' or -B $Is) { 
+                #   file seems to be a binary file
+                #   FIXME
+            }
+            else {
+                #   file seems to be a regular file
+                #   FIXME
             }
         }
 
@@ -1780,11 +1815,6 @@
         $cvsinfo =~ m|^([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+)$|
              || die "invalid loginfo argument `$cvsinfo' while accumulating information";
         my ($Is, $IV, $Iv, $It, $Io, $Ik, $ID, $Id) = ($1, $2, $3, $4, $5, $6, $7, $8, $9);
-        if ($Io eq 'R' and $ID eq '0') {
-            #   CVS does not provide a commit time for removed files
-            #   so use the current time as a replacement
-            $ID = time();
-        }
         my $e = {};
         $e->{oldrev} = $IV;
         $e->{newrev} = $Iv;

CVSTrac 2.0.1