-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathsetup-test.sh
executable file
·55 lines (47 loc) · 1.43 KB
/
setup-test.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
54
55
#!/bin/bash
##
# Uses a git repo to create a p4 history that we can replay over and
# over to test that o4 indeed leaves it all pristine.
TD=/tmp/zsync
mkdir -p $TD
#mkdir -p /tmp/p4d
# start p4d -r /tmp/p4d -p localhost:1667
# Create the zsync depot: p4 depot zsync
export P4PORT=tcp:localhost:1667
cd $TD
# Create a client: p4 client
# make sure /tmp/o4test is the client root
# make sure zsync is in the mappings
# make sure to set rmdir, not normdir
# cd $(dirname $TD)
#git clone [email protected]:philipbergen/zsync.git
#cd zsync
#git log --pretty=format:"%H" --reverse >|../zsync.log
set -eux
cat ../zsync.log | while read v; do
#for v in $(head ../zsync.log); do
echo "****************************************************************"
echo "GIT $v"
# Make all files readable so git works and
git clean -df .
p4 edit ... >/dev/null
chmod -R a+w .git *
git reset --hard $v
#git reset --hard
p4 add ... >/dev/null
# Revert unchanged
p4 revert -a ...
git ls-files --others --exclude-standard | xargs -n1 p4 delete
p4 submit -d $v
git status
# Create dummy changelists to create sparse changelist history
n=$((RANDOM % 100))
if [ $n -gt 0 ]; then
for i in $(seq 1 $n); do
txt=$(echo -e "Change: new\nDescription: dummy-change $i" |p4 change -i)
p4 change -d $(echo $txt | cut -d\ -f2)
done
fi
#echo "Press enter to continue."
#read
done