From: Jarkko Hietaniemi Date: Mon, 6 May 2002 12:12:59 +0000 (+0000) Subject: Ultimate discouragement for the old tools, from Andreas. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a2c6387bcf04cf5542d4fb14b9aa2a097a31350e;p=p5sagit%2Fp5-mst-13.2.git Ultimate discouragement for the old tools, from Andreas. p4raw-id: //depot/perl@16428 --- diff --git a/MANIFEST b/MANIFEST index 65dc335..eced52d 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2206,8 +2206,6 @@ Porting/fixvars Find undeclared variables with C compiler and fix em Porting/genlog Generate formatted changelogs by querying p4d Porting/Glossary Glossary of config.sh variables Porting/makerel Release making utility -Porting/p4d2p Generate standard patches from p4 diffs -Porting/p4desc Smarter 'p4 describe', outputs diffs for new files Porting/p4genpatch Obsoletes both p4desc and p4d2p Porting/patching.pod How to report changes made to Perl Porting/patchls Flexible patch file listing utility diff --git a/Porting/p4d2p b/Porting/p4d2p deleted file mode 100755 index f645ef8..0000000 --- a/Porting/p4d2p +++ /dev/null @@ -1,84 +0,0 @@ -#!/l/local/bin/perl -wspi.bak - -# -# reads a perforce style diff on stdin and outputs appropriate headers -# so the diff can be applied with the patch program -# -# Gurusamy Sarathy -# - -BEGIN { - $0 =~ s|.*/||; - if ($h or $help) { - print STDERR < change-123.patch - -USAGE - exit(0); - } - unless (@ARGV) { @ARGV = '-'; undef $^I; } - use vars qw($thisfile $time $file $fnum $v $h $help); - $thisfile = ""; - $time = localtime(time); -} - -my ($cur, $match); -$cur = m<^==== //depot/(.+?)\#\d+.* ====$> ... m<^(\@\@.+\@\@|\*+)$>; - -$match = $1; - -if ($ARGV ne $thisfile) { - warn "processing patchfile [$ARGV]\n" unless $ARGV eq '-'; - $thisfile = $ARGV; -} - -# while we are within range -if ($cur) { - # set the file name after first line - if ($cur == 1) { - $file = $match; - $fnum++; - } - # emit the diff header when we hit last line - elsif ($cur =~ /E0$/) { - my $f = $file; - - # special hack for perl so we can always use "patch -p1" - $f =~ s<^.*?(perl.*?/)><$1>; - - # unified diff - if ($match =~ /^\@/) { - warn "emitting udiff header\n" if $v; - $_ = "Index: $f\n--- $f.~1~\t$time\n+++ $f\t$time\n$_"; - } - # context diff - elsif ($match =~ /^\*/) { - warn "emitting cdiff header\n" if $v; - $_ = "Index: $f\n*** $f.~1~\t$time\n--- $f\t$time\n$_"; - } - } - # see if we hit another patch (i.e. previous patch was empty) - elsif (m<^==== //depot/(.+?)\#\d+.* ====$>) { - $file = $match = $1; - } - # suppress all other lines in the header - else { - $_ = ""; - } - warn "file [$file] line [$cur] file# [$fnum]\n" if $v; -} - -$_ .= "End of Patch.\n" if eof; diff --git a/Porting/p4desc b/Porting/p4desc deleted file mode 100755 index 2d1c9d8..0000000 --- a/Porting/p4desc +++ /dev/null @@ -1,147 +0,0 @@ -#!/usr/bin/perl -wpi.bak - -# -# Munge "p4 describe ..." output to include new files. -# -# Gurusamy Sarathy -# - -use vars qw($thisfile $change $file $fnum $h $v $p4port @addfiles - $branches $skip); - -BEGIN { - $0 =~ s|^.*/||; - $p4port = $ENV{P4PORT} || 'localhost:1666'; - for (@ARGV) { - if ($p4port =~ /^\s+$/) { - $p4port = $_; - } - elsif (/^-p(.*)$/) { - $p4port = $1 || ' '; - } - elsif (/^-b(.*)$/) { - $branches = $1; - } - elsif (/^-v$/) { - $v++; - } - elsif (/^-h/) { - $h++; - } - else { - push @files, $_; - } - } - unless (@files) { @files = '-'; undef $^I; } - @ARGV = @files; - $branches = '//depot/perl/' unless defined $branches; - if ($h) { - print STDERR < change-123.desc - p4 describe -du 123 | $0 | p4d2p > change-123.patch - -USAGE - exit(0); - } - $thisfile = ""; -} - - -if ($ARGV ne $thisfile) { - warn "processing patchfile [$ARGV]\n" unless $ARGV eq '-'; - $thisfile = $ARGV; -} - -my $cur = m|^Affected files| ... m|^Differences|; - -# while we are within range -if ($cur) { - if (m|^\.\.\. |) { - if (m|$branches|) { - if (m{^\.\.\. (//depot/.+?\#\d+) (add|branch)$}) { - my $newfile = $1; - push @addfiles, $newfile; - warn "$newfile add, revision != 1!\n" unless $newfile =~ /#1$/; - } - } else { - push @skipped, "# $_"; - $_ = ''; - } - } - warn "file [$file] line [$cur] file# [$fnum]\n" if $v; -} - -if (m|^==== //depot/|) { - $skip = !m|$branches|; - print "# Skipped because not under branches: $branches\n" if $skip; -} - -$_ = "# $_" if $skip; - -if (/^Change (\d+) by/) { - $_ = "\n\n" . $_ if $change; # start of a new change list - $change = $1; - my $new = newfiles(); - if ($new) { - $_ = $new . $_; - } -} - -if (eof) { - $_ .= newfiles(); - $_ .= join('', "\n", - "# Skipped because not under branches: $branches\n", - @skipped, "\n") if @skipped; -} - -sub newfiles { - my $addfile; - my $ret = ""; - for $addfile (@addfiles) { - my $type = `p4 -p $p4port files '$addfile'`; - if ($?) { - 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 ($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; -} diff --git a/Porting/repository.pod b/Porting/repository.pod index 5887e21..d1667b7 100644 --- a/Porting/repository.pod +++ b/Porting/repository.pod @@ -328,9 +328,9 @@ back into the mainline, they do: Generating a patch for change#42 is done as follows: - % p4 describe -du 42 | p4desc | p4d2p > change-42.patch + % p4genpatch 42 > change-42.patch -F and F<>p4d2p> are to be found in //depot/perl/Porting/. +F is to be found in //depot/perl/Porting/. The usual routine to apply a patch is @@ -356,7 +356,7 @@ Other useful Perforce commands % p4 describe -du 12345 # show change 12345 Note: the output of "p4 describe" is not in proper diff format, use -the F to convert. +the F to get a diff-compatible format. % p4 diff -se ./... # have I modified something but forgotten # to "p4 edit", easy faux pas with autogenerated