-
Notifications
You must be signed in to change notification settings - Fork 19
/
map_changes.sh
executable file
·53 lines (39 loc) · 1.06 KB
/
map_changes.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
# Grab a load of P4Transfer'ed changes and extra target/source mappings
# p4 changes -ltm999 //UE5/Release-Engine-Staging/... |
show_help_info () {
echo -e "\n\tERROR: $1"
cat <<HELPINFO
---
Usage:
./map_changes.sh <num_changes> <path>
Example:
./map_changes.sh 99 //UE5/Release-5.0/...
HELPINFO
}
function msg () { echo -e "$*"; }
function bail () { msg "\nError: ${1:-Unknown Error}\n"; exit ${2:-1}; }
# -------------------------------------------------------------------------
if [ -z "$1" ];then
show_help_info "No <num_changes> parameter specified"
exit 1
fi
if [ -z "$2" ];then
show_help_info "No <depot_path> parameter specified"
exit 1
fi
# Get path/file parm
max_changes=$1
depot_path=$2
src=0
targ=0
p4 changes -lm $max_changes $depot_path | egrep "^Change |^\s+Transferred from p4:" | while read -e line
do
if [[ $line =~ ^Change\ ([0-9]+) ]]; then
targ="${BASH_REMATCH[1]}"
fi
if [[ $line =~ Transferred\ from.*\@([0-9]+)$ ]]; then
src="${BASH_REMATCH[1]}"
echo "$src,$targ"
fi
done