X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=Porting%2Fp4desc;h=0bf79da2e004b2df741c73b17cd2a382f796aca8;hb=be28567c7b4a66645fbbd71964c8c6819169207c;hp=062a6f122bc9b3b676c62e93e5b6c2429d34d0aa;hpb=1f8488031ad013b6fc4a66ab2503ebf23dbf32aa;p=p5sagit%2Fp5-mst-13.2.git diff --git a/Porting/p4desc b/Porting/p4desc index 062a6f1..0bf79da 100755 --- a/Porting/p4desc +++ b/Porting/p4desc @@ -1,9 +1,9 @@ -#!/l/local/bin/perl -wpi.bak +#!/usr/bin/perl -wpi.bak # # Munge "p4 describe ..." output to include new files. # -# Gurusamy Sarathy +# Gurusamy Sarathy # use vars qw($thisfile $change $file $fnum $h $v $p4port @addfiles); @@ -65,7 +65,7 @@ my $cur = m|^Affected files| ... m|^Differences|; # while we are within range if ($cur) { - if (m|^\.\.\. (//depot/.+?#\d+) add$|) { + if (m{^\.\.\. (//depot/.+?#\d+) (add|branch)$}) { my $newfile = $1; push @addfiles, $newfile; warn "$newfile add, revision != 1!\n" unless $newfile =~ /#1$/; @@ -90,16 +90,28 @@ sub newfiles { my $addfile; my $ret = ""; for $addfile (@addfiles) { - my @new = `p4 -p $p4port print $addfile`; + my $type = `p4 -p $p4port files '$addfile'`; if ($?) { - die "$0: `p4 -p $p4port print $addfile` failed, status[$?]\n"; + warn "$0: `p4 -p $p4port print '$addfile'` failed, status[$?]\n"; + next; + } + $type =~ m|^//.*\((.+)\)$| or next; + $type = $1; + unless ($type =~ /text/) { + $ret .= "\n==== $addfile ($type) ====\n\n"; + next; + } + my @new = `p4 -p $p4port print '$addfile'`; + if ($?) { + die "$0: `p4 -p $p4port print '$addfile'` failed, status[$?]\n"; } my $desc = shift @new; # discard initial description - $ret .= "\n==== $addfile (text) ====\n\n"; + $ret .= "\n==== $addfile ($type) ====\n\n"; my $lines = "," . @new; $lines = "" if @new < 2; $ret .= "\@\@ -0,0 +1$lines \@\@\n"; $ret .= join("+","",@new); + $ret .= "\n\\ No newline at end of file\n" if $ret !~ /\n$/; } @addfiles = (); return $ret;