On Tue, Aug 07, 2001 at 09:36:01 -0700, John Baldwin wrote:
> 
> On 07-Aug-01 Julian Elischer wrote:
> > 
> > I have pushed the thread pointers down through most of the code
> > though there are still many many places that assume that there is only one
> > thread per process. (no multithreading yet, but getting closer..)
> > 
> > At this stage diffs must be pushing close to 1MB (maybe more)
> > (I don't know as I don't know yet how to get p4 to generate diffs :-)
> 
> It's not too hard.  I have the smpng and jhb_preemption batches updating
> diff's on freefall via cron. :)
> 
> To do a diff of files against files you have checked out, you use 'p4 diff'
> such as 'p4 diff -du ...' to get a unified diff.  Unfortunately, p4's diff
> format isn't too patch friendly.  There is also a 'p4 diff2' which does a
> diff of files in the depot.  p4 diff2 has an undocumented (well, it's
> documented in 'p4 help undoc') option -u that will produce a unified diff that
> patch can grok (albeit, it has the full depot path, so you'll have to use -p6
> or some such to apply it).  If you had a julian_kse branch off of the kse
> branch you would use 'p4 diff2 -u -b julian_kse' to get a diff of the entire
> branch.  You can use 'p4 diff2 -u -b kse' to get a diff of the kse branch
> against the head, but unfortunately it does a diff against the head of the
> -current vendor import rather than against the latest files you last integrated
> from.

According to the docs, p4 diff2 -u only produces diffs on files that are in
both paths and differ.  So files that are added in one branch won't be
shown.

Attached is an awk script that was originally written by Justin (hacked up
by me somewhat) that I use on my zero copy branch to fix up the perforce
diff output.  It will produce diffs for files that are only in one branch.

So basically I use it like this:

p4 diff2 -dc //depot/FreeBSD-current/src/... //depot/FreeBSD-zero/src/... > foo

cat foo | awk -f awkdiff.zero > diffs.fixed

Ken
-- 
Kenneth Merry
[EMAIL PROTECTED]
$1 == "===="    {
        last_line = $0
        last_filename = $2
        gsub(/\/\/depot\/FreeBSD-zero\/src/, "src", last_filename)
        gsub(/\/\/depot\/FreeBSD-current\/src/, "src", last_filename)
        gsub(/#[0-9]*$/, "", last_filename)
        did_sub = 0
}
$1 == "===="  && $2 == "<" && $3 == "none" && $4 == ">" {
        new_file = $6
        gsub(/\/\/depot\/FreeBSD-zero\/src/, "src", new_file)
        gsub(/\/\/depot\/FreeBSD-current\/src/, "src", new_file)
#       gsub(/\/usr\/home\/ken\/perforce\/cam/, "src", new_file)
        gsub(/#[0-9]*$/, "", new_file)
        old_sep=OFS
        OFS=""
        print "#!/bin/sh" > "/tmp/make_diff"
        print "p4 print ", $6, " | sed '/^\\/\\/depot/d' > /tmp/foo" >> 
"/tmp/make_diff"
        print "diff -c /dev/null /tmp/foo | sed s@/tmp/foo@", new_file, "@" >> 
"/tmp/make_diff"
        close("/tmp/make_diff")
        OFS=old_sep
        system("sh /tmp/make_diff")
#       print $0
}
$1 != "===="    {
        if (!did_sub && $1 == "***************") {
                print "***", last_filename ".orig"
                print "---", last_filename
                print $1
                did_sub = 1
        } else {
                print $0
        }
}

Reply via email to