Change 16423 by gsar@onru on 2002/05/06 05:25:59

        p4genpatch: avoid stderr noise during adds

Affected files ...

.... //depot/perl/Porting/p4genpatch#8 edit

Differences ...

==== //depot/perl/Porting/p4genpatch#8 (text) ====
Index: perl/Porting/p4genpatch
--- perl/Porting/p4genpatch#7~16416~    Sun May  5 10:00:33 2002
+++ perl/Porting/p4genpatch     Sun May  5 22:25:59 2002
@@ -57,13 +57,14 @@
   my($depotfile) = $file =~ m|^(.+)#\d+\z|;
   die "Panic: Could not parse file[$file]" unless $number;
   $path = "" unless defined $path;
-  my($d1,$d2,$prev,$prevchange,$prevfile);
+  my($d1,$d2,$prev,$prevchange,$prevfile,$doadd);
   $prev = $number-1;
   $prevchange = $CHANGE-1;
   # can't assume previous rev == $number-1 due to obliterated revisions
   $prevfile = "$depotfile\@$prevchange";
   if ($number == 1 or $action =~ /^(add|branch)$/) {
     $d1 = "/dev/null";
+    ++$doadd;
   } elsif ($action =~ /^(edit|integrate)$/) {
     $d1 = "$path$basename-$prevchange";
     warn "==> $d1 <==\n" if $OPT{v};
@@ -96,13 +97,13 @@
   chmod 0644, "$tempdir/$d2";
   $type =~ m|^//.*\((.+)\)$| or next;
   $type = $1;
-  if (File::Compare::compare("$tempdir/$d1", "$tempdir/$d2")) {
+  if ($doadd or File::Compare::compare("$tempdir/$d1", "$tempdir/$d2")) {
     print "\n==== $file ($type) ====\n";
     unless ($type =~ /text/) {
       next;
     }
     print "Index: $path$basename\n";
-    correctmtime($prevfile,$prev,"$tempdir/$d1");
+    correctmtime($prevfile,$prev,"$tempdir/$d1") unless $doadd;
     correctmtime($file,$number,"$tempdir/$d2");
     chdir $tempdir or warn "Could not chdir '$tempdir': $!";
     $system = qq[$OPT{D} -$OPT{d} "$d1" "$d2"];
@@ -117,8 +118,8 @@
 
 sub correctmtime ($$$) {
   my($depotfile,$nr,$localfile) = @_;
-  my %fstat = map { /^\.\.\. (\w+) (.*)$/ } `p4 @P4opt fstat "$depotfile"`;
-  return unless $fstat{headRev} == $nr;
+  my %fstat = map { /^\.\.\. (\w+) (.*)$/ } `p4 @P4opt fstat -s "$depotfile"`;
+  return unless exists($fstat{headRev}) and $fstat{headRev} == $nr;
   utime $fstat{headTime}, $fstat{headTime}, $localfile;
 }
 
End of Patch.

Reply via email to