export P4MERGE="p4merge"
fi
unset p4script p4vim
+
+# p4: Wrapper around p4 to add some other features.
+function p4() {
+ if [ -z "$P4OPTSTRING" -a ! "${P4OPTSTRING+xxx}" = "xxx" ]; then
+ local p4=$(which p4)
+ P4OPTSTRING="$(strings $p4 | grep H:)"
+ fi
+
+ local opts=
+ OPTIND=1
+ if [ -n "$P4OPTSTRING" ]; then
+ while getopts "$P4OPTSTRING" opt; do
+ [ "$opt" = "?" ] && continue
+ opts="$opts -$opt $OPTARG"
+ done
+ shift $((OPTIND-1))
+ fi
+
+ command="$1"; shift
+ custom=${PROFILE_HOME:-~}/opt/p4/p4-"$command"
+
+ if [ -x "$custom" ]; then
+ "$custom" $opts "$command" ${1+"$@"}
+ else
+ ( exec p4 $opts "$command" ${1+"$@"} )
+ fi
+}