diff --git a/tools/tools/perforce/awkdiff b/tools/tools/perforce/awkdiff new file mode 100755 index 000000000000..380d6fa26f93 --- /dev/null +++ b/tools/tools/perforce/awkdiff @@ -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 + } +} diff --git a/tools/tools/perforce/p4diffbranch b/tools/tools/perforce/p4diffbranch new file mode 100755 index 000000000000..9d29f23c5019 --- /dev/null +++ b/tools/tools/perforce/p4diffbranch @@ -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"