Date: Sun, 26 Sep 1999 14:16:05 -0700 From: Bill Fenner <fenner@research.att.com> To: billf@jade.chc-chimes.com Cc: ports@freebsd.org Subject: Re: Help with RCS files, patches, and PR's required. Message-ID: <199909262116.OAA28655@windsor.research.att.com>
next in thread | raw e-mail | index | archive | help
--19701020 Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline >I know I prefer unified (to the point that I skip over non unified diffs) Or use my handy filter. Once I started using unidiff I stopped being able to read context diffs. It works on many but not all context diffs I've thrown at it. Bill --19701020 Content-Type: application/x-perl; name="ctou"; x-unix-mode=0755 Content-Disposition: attachment; filename="ctou" #!/usr/common/bin/perl -s # # # ctou # 1 February 1999 # Bill Fenner <fenner@parc.xerox.com> # turn diff -c output into diff -u output. # # context: # *** FROM-FILE FROM-FILE-MODIFICATION-TIME # --- TO-FILE TO-FILE-MODIFICATION TIME # *************** # *** FROM-FILE-LINE-RANGE **** # FROM-FILE-LINE # FROM-FILE-LINE... # --- TO-FILE-LINE-RANGE ---- # TO-FILE-LINE # TO-FILE-LINE... # # Note that if there were no removals/changes, FROM-FILE-LINE section can be # empty, and if there were no additions/changes, TO-FILE-LINE section can be # empty. # # uni: # --- FROM-FILE FROM-FILE-MODIFICATION-TIME # +++ TO-FILE TO-FILE-MODIFICATION-TIME # @@ FROM-FILE-RANGE TO-FILE-RANGE @@ # LINE-FROM-EITHER-FILE # LINE-FROM-EITHER-FILE... # # $in = 0; while (<>) { chop; print ($in,">",$_,"\n") if ($d); if (/^\*\*\*\s+(\S+)\s+\*\*\*\*$/) { $fromrange = $1; @from = (); $in = 1; next; } if (/^---\s+(\S+)\s+----$/) { $torange = $1; @to = (); $in = 2; next; } if (/^[^-+! ]/) { if ($in != 0) { &handleit; $in = 0; } } if ($in == 0) { if (/^\*\*\*(\s+.*)/) { print "---$1\n"; } elsif (/^---(\s+.*)/) { print "+++$1\n"; } elsif (/^\*\*\*\*\*/) { # part of context diff header } else { print $_, "\n"; } } elsif ($in == 1) { push(@from, $_); } elsif ($in == 2) { push(@to, $_); } else { die "in is $in!\n"; } } if ($in != 0) { &handleit; } sub handleit { local($fromline, $toline) = ($[, $[); local($fromstart, $fromend) = split(/,/, $fromrange); local($tostart, $toend) = split(/,/, $torange); print "@@ -", $fromstart, ",", $fromend - $fromstart + 1; print " +", $tostart, ",", $toend - $tostart + 1, " @@\n"; while ($fromline <= $#from || $toline <= $#to) { if ($fromline > $#from) { ($fchar, $f) = ("X", undef); } else { ($fchar, $f) = ($from[$fromline] =~ /^(.)\s(.*)/); } if ($toline > $#to) { ($tchar, $t) = ("X", undef); } else { ($tchar, $t) = ($to[$toline] =~ /^(.)\s(.*)/); } if ($fchar eq "!") { print "-", $f, "\n"; $fromline++; next; } if ($tchar eq "!") { print "+", $t, "\n"; $toline++; next; } if ($fchar eq "-") { print $fchar, $f, "\n"; $fromline++; next; } if ($tchar eq "+") { print $tchar, $t, "\n"; $toline++; next; } if ($fchar eq " ") { print " ",$f,"\n"; $fromline++; $toline++; next; } if ($tchar eq " ") { print " ",$t,"\n"; $fromline++; $toline++; next; } die "fchar is $fchar, tchar is $tchar, gonna loop!"; } } --19701020-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199909262116.OAA28655>