From: Iain Patterson Date: Sat, 16 Apr 2011 11:43:00 +0000 (+0100) Subject: Override "p4 diff" to handle change numbers. X-Git-Url: http://git.iain.cx/?p=profile.git;a=commitdiff_plain;h=f5afac834b03d5ee46adec982095852609b1b58c Override "p4 diff" to handle change numbers. Wrapper around "p4 diff" which detects use of the -c flag and calls p4-diffchange, thus enabling uses such as "p4 diff -c 12345" which will show diffs only for files opened in changelist 12345. --- diff --git a/opt/p4/p4-diff b/opt/p4/p4-diff new file mode 100755 index 0000000..2ecc0d5 --- /dev/null +++ b/opt/p4/p4-diff @@ -0,0 +1,17 @@ +#!/bin/bash + +. ${0%/*}/common + +function parse_change() { + while getopts ":c:" opt; do + case $opt in + c) echo $OPTARG;; + esac + done +} + +if [ -n "$(parse_change $*)" ]; then + exec ${0%/*}/p4-diffchange $p4opts diffchange ${1+"$@"} +else + exec p4 $p4opts $p4command ${1+"$@"} +fi