From owner-svn-src-head@FreeBSD.ORG Wed Aug 27 18:56:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 15882B32; Wed, 27 Aug 2014 18:56:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC3033B19; Wed, 27 Aug 2014 18:56:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7RIuCSg023315; Wed, 27 Aug 2014 18:56:12 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7RIuCL9023312; Wed, 27 Aug 2014 18:56:12 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <201408271856.s7RIuCL9023312@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Wed, 27 Aug 2014 18:56:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r270727 - head/tools/tools/perforce X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Aug 2014 18:56:13 -0000 Author: jmg Date: Wed Aug 27 18:56:12 2014 New Revision: 270727 URL: http://svnweb.freebsd.org/changeset/base/270727 Log: add scripts for generating a diff from p4... awkdiff is the script from scottl that he got from ken a long time ago... It no longer lives in his home dir, so give it a new home... This does simple massaging of p4 output to create a useful diff... The script p4diffbranch will create a diff that includes new and deleted files unlike the normal diff2 -b command... So will be useful for extracting patches from p4... It does take a changeset that will be used to diff against... Added: head/tools/tools/perforce/ head/tools/tools/perforce/awkdiff (contents, props changed) head/tools/tools/perforce/p4diffbranch (contents, props changed) Added: head/tools/tools/perforce/awkdiff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/perforce/awkdiff Wed Aug 27 18:56:12 2014 (r270727) @@ -0,0 +1,42 @@ +#!/usr/bin/awk -f +# +# $FreeBSD$ +# + +BEGIN { + #parentpath = "//depot/vendor/freebsd/src/sys/" + #childpath = "//depot/projects/opencrypto/" +} +$1 == "====" { + last_line = $0 + last_filename = $2 + #gsub(parentpath, "", last_filename) + gsub(/#[0-9]*$/, "", last_filename) + did_sub = 0 +} +$1 == "====" && $2 == "" { + new_file = $4 + gsub(childpath, "", new_file) + gsub(/#[0-9]*$/, "", new_file) + cmd = "p4 print \"" $4 "\" | sed '/^\\/\\/depot/d' | diff -u /dev/null /dev/stdin | sed s@/dev/stdin@" new_file "@" + #print "x" cmd "x" + system(cmd) +} +$1 == "====" && $4 == "" { + del_file = $2 + gsub(parentpath, "", del_file) + gsub(/#[0-9]*$/, "", del_file) + cmd = "p4 print \"" $2 "\" | sed '/^\\/\\/depot/d' | diff -u /dev/stdin /dev/null | sed s@/dev/stdin@" del_file "@" + #print "x" cmd "x" + system(cmd) +} +$1 != "====" { + if (!did_sub && (($1 == "***************") || ($1 == "@@"))) { + print "--- ", last_filename ".orig" + print "+++ ", last_filename + print $0 + did_sub = 1 + } else { + print $0 + } +} Added: head/tools/tools/perforce/p4diffbranch ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/perforce/p4diffbranch Wed Aug 27 18:56:12 2014 (r270727) @@ -0,0 +1,19 @@ +#!/bin/sh - +# +# $FreeBSD$ +# + +if [ x"$#" != x"2" ]; then + echo "Usage: $0 " + exit 1 +fi + +basescript="$(realpath "$0")" +awkdiff="${basescript%/*}/awkdiff" + +branch="$1" +changenum="$2" + +p4 branch -o "$branch" | + awk ' /^View:/ { doview = 1; next; } /^[^ ]/ {doview = 0; next; } $1 && $2 && doview == 1 { system("p4 diff2 -du " $1 "@" changenum " " $2) }' changenum="$changenum" | + "$awkdiff"