-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathrun_compare.sh
More file actions
executable file
·30 lines (26 loc) · 997 Bytes
/
run_compare.sh
File metadata and controls
executable file
·30 lines (26 loc) · 997 Bytes
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
#!/bin/bash
# Runs compares against all depot paths found in target client.
# Assumptions:
# - target dir exists and P4CONFIG is setup
# - source/target use same depot paths
configFile=ue_config.yaml
compare=../p4transfer.git/CompareRepos.py
counterName=$(grep ^counter_name: $configFile | awk '{print $2}')
export P4CONFIG=.p4config.txt
pushd target
readarray -t lines < <(p4 client -o | grep -A99 ^View: | grep -v View: | awk '{print $1}')
counter=$(p4 counters | grep "$counterName" | awk '{print $3}')
popd
for v in "${lines[@]}"
do
output="${v//\//_}"
output="${output//./}"
$compare -c $configFile -s "$v@$counter" > "compare${output}.out"
differences=$(grep "Sum Total:" "compare${output}.out" | tail -1 | awk '{print $3}')
if [[ $differences -gt 0 ]]; then
$compare -c $configFile -s "$v@$counter" --fix
pushd target
p4 --field Description="Fix differences from snapshot of $v@$counter" change -o | p4 change -i
popd
fi
done