From: Chip Salzenberg Date: Mon, 24 Feb 2003 21:42:57 +0000 (+0000) Subject: Include p4d2p in Porting again, because p4genpatch doesn't work X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=70dff1ffd3015a4493d81957b4a83083b5c17679;p=p5sagit%2Fp5-mst-13.2.git Include p4d2p in Porting again, because p4genpatch doesn't work until a change has been submitted. p4raw-id: //depot/perl@18768 --- diff --git a/MANIFEST b/MANIFEST index 7df7152..4695eb3 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2300,7 +2300,8 @@ 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/p4genpatch Obsoletes both p4desc and p4d2p +Porting/p4d2p Generate patch from p4 diff +Porting/p4genpatch Generate patch from p4 change in repository (obsoletes p4desc) Porting/patching.pod How to report changes made to Perl Porting/patchls Flexible patch file listing utility Porting/pumpkin.pod Guidelines and hints for Perl maintainers diff --git a/Porting/p4d2p b/Porting/p4d2p new file mode 100755 index 0000000..83b0021 --- /dev/null +++ b/Porting/p4d2p @@ -0,0 +1,84 @@ +#!/usr/bin/perl -wspi~ + +# +# 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;