From owner-freebsd-hackers@FreeBSD.ORG Mon Apr 7 14:58:34 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A0051065670 for ; Mon, 7 Apr 2008 14:58:34 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 1B6C88FC17 for ; Mon, 7 Apr 2008 14:58:34 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from zion.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by elvis.mu.org (Postfix) with ESMTP id 51E611A4D8C; Mon, 7 Apr 2008 07:58:32 -0700 (PDT) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Mon, 7 Apr 2008 10:39:07 -0400 User-Agent: KMail/1.9.7 References: <20080405145038.GE5934@hoeg.nl> In-Reply-To: <20080405145038.GE5934@hoeg.nl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200804071039.07210.jhb@freebsd.org> Cc: Ed Schouten Subject: Re: Perforce and `p4 diff2' against the origin X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Apr 2008 14:58:34 -0000 On Saturday 05 April 2008 10:50:38 am Ed Schouten wrote: > Hello everyone, > > Because my mpsafetty project in Perforce is going quite well, I'm > considering running some kind of cron job to generate nightly diffs, so > other people (interested friends, colleagues and others) to test my > work. > > I've read `p4 help diff2' and it seems you can run the following > command: > > p4 diff2 -b mpsafetty > > Unfortunately this command just does a braindead diff against the latest > FreeBSD vendor source, which is not useful in my case. I just want it to > generate a diff against the version I integrated. > > Is it possible to do this with Perforce? One option is to create a label and sync it each time you do an integ. I do this for projects/smpng. Then I can do: p4 diff2 -u -b smpng @smpng_base #head Another option is to use a convention when you do integ's. What I tend to do is when I do a 'p4 integ' I first do a 'p4 changes -m 10' in another window and include the last 'importer' submit in my submit message by having a message of: 'IFC @XXXXXX' e.g. 'IFC @12345' Then you can use p4 changes on your branch and find the last IFC and use that diff like so: p4 diff2 -u -b mybranch @12345 #head I have a script to look in p4 changes of the branch to find the last IFC commit and figure out the '12345' part automatically like so: #!/bin/sh b=$1 change=$(p4 changes -m 20 //depot/user/jhb/${b}/... | awk '/IFC @[1-9][0-9]*/ { match($0, /@[1-9][0-9]*/); printf "%s\n", substr($0, RSTART, RLENGTH); exit 0 }') echo "Updating ~/work/patches/$b.patch" p4 diff2 -u -b jhb_$b $change \#head > ~/work/patches/$b.patch -- John Baldwin