| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- export P4EDITOR=/home/user/wreed/bin/vim
- export P4DIFF="/home/user/wreed/bin/vim -d"
- export P4MERGE="/home/user/wreed/bin/vim -d"
- alias p4a="p4 add"
- alias p4e="p4 edit"
- alias p4r="p4 revert"
- alias p4s="p4 sync"
- alias p4d="p4 delete"
- alias p4o="p4 opened"
- alias p4c="p4 client"
- alias p4i="p4 integrate"
- alias p4grab="p4 diff -se | p4 -x - edit"
- alias p4reset="p4 diff -sr | p4 -x - revert"
- p4whose() {
- if [[ $# -ne 1 ]]; then return 1; fi
- local file="${1}"
- if [[ ${file:0:2} != "//" ]]; then local file="//depot/online/makefds/mainline/${file}"; fi
- # Get only lines with a change source (no integrate/branch)
- # Pull the name of each submitter
- # Uniqueify without losing order
- # Attach a number to them
- p4 filelog "${file}" | \
- grep -E "^\.\.\. #" | \
- awk '{ print $9 }' | cut -d'@' -f1 | \
- perl -ne 'if (!defined $x{$_}) { print $_; $x{$_} = 1; }' | \
- awk 'BEGIN { idx=1 } { print idx,$0; idx += 1 }'
- }
- p4backout() {
- local changenum="$1"
- local target_stage="${2:-fdsparent}"
- local lastchange=$((changenum-1))
- p4 sync @$lastchange
- p4 edit ...
- p4 sync @$changenum
- p4 resolve -ay
- p4 sync @$target_stage
- p4 resolve -am
- }
- p4_import_changelist() {
- local changelist="${1}"
- local tmpfile=$(mktemp)
- trap "rm -f ${tmpfile}" EXIT
- p4 client -o > "${tmpfile}"
- local client=$(grep -E "^Client:" "${tmpfile}" | awk '{ print $2 }')
- local files=($(IFS=$'\n'; p4 describe -s "${changelist}" | grep -E "^\.\.\." | cut -d' ' -f2- | cut -d'#' -f1))
- local has_view=$(grep -c -E "^View:" "${tmpfile}")
- if [[ $has_view -eq 0 ]]
- then
- echo "View:" >> "${tmpfile}"
- fi
- for file in "${files[@]}"
- do
- local mapping="//${client}/${file##*/}"
- echo -e "\t${file} ${mapping}" >> "${tmpfile}"
- done
- p4 client -i < "${tmpfile}"
- }
- . ${HOME}/.complete-p4
|