-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathp4funcs.bash
executable file
·51 lines (41 loc) · 1.18 KB
/
p4funcs.bash
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
#!/bin/bash
p4depot()
{
cwd=$PWD
depot=`p4 client -o $USER.$1 | grep "$USER.$1/\.\.\." | sed 's/.*\(\/\/.*\.\.\.\).*\.\.\./\1/'`
builtin cd $cwd
}
p4integrate()
{
if [ $# -lt 2 ]; then
echo "p4integrate <source> <dest>"
echo " This does a integrate of all changelists submitted on <source> to <dest>."
echo " The source/dest name is as they appear in the directory."
return 1
fi
for i in $1 $2; do
if [ ! -d "$i" ]; then
echo "Couldn't find directory $i"
return 1
fi
done
p4depot $1
sdepot=$depot
p4depot $2
ddepot=$depot
echo "src depot = '$sdepot'"
echo "dst depot = '$ddepot'"
cls=(`p4 changes $sdepot |sort|sed '1d'|cut -d' ' -f2`)
if [ "${#cls[@]}" -eq 0 ]; then
echo "No changelists available on $sdepot"
return 1;
fi
first="${cls[0]}"
last="${cls[${#cls[@]}-1]}"
echo "Integrating"
echo " $sdepot@$first-$last"
echo "-> $ddepot"
echo "This might take some time, be patient..."
echo p4 -c $USER.$2 integrate -q $sdepot@$first,$last $ddepot
# p4 -c $USER.$2 integrate -q $sdepot@$first,$last $ddepot
}