##// END OF EJS Templates
tests: Don't use $PWD...
Mads Kiilerich -
r10275:3a1f29b6 stable
parent child Browse files
Show More
@@ -1,104 +1,104 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 "$TESTDIR/hghave" p4 execbit symlink || exit 80
3 "$TESTDIR/hghave" p4 execbit symlink || exit 80
4
4
5 echo "[extensions]" >> $HGRCPATH
5 echo "[extensions]" >> $HGRCPATH
6 echo "convert = " >> $HGRCPATH
6 echo "convert = " >> $HGRCPATH
7
7
8 echo % create p4 depot
8 echo % create p4 depot
9 P4ROOT=$PWD/depot; export P4ROOT
9 P4ROOT=`pwd`/depot; export P4ROOT
10 P4AUDIT=$P4ROOT/audit; export P4AUDIT
10 P4AUDIT=$P4ROOT/audit; export P4AUDIT
11 P4JOURNAL=$P4ROOT/journal; export P4JOURNAL
11 P4JOURNAL=$P4ROOT/journal; export P4JOURNAL
12 P4LOG=$P4ROOT/log; export P4LOG
12 P4LOG=$P4ROOT/log; export P4LOG
13 P4PORT=localhost:16661; export P4PORT
13 P4PORT=localhost:16661; export P4PORT
14 P4DEBUG=1; export P4DEBUG
14 P4DEBUG=1; export P4DEBUG
15 P4CHARSET=utf8; export P4CHARSET
15 P4CHARSET=utf8; export P4CHARSET
16
16
17 echo % start the p4 server
17 echo % start the p4 server
18 [ ! -d $P4ROOT ] && mkdir $P4ROOT
18 [ ! -d $P4ROOT ] && mkdir $P4ROOT
19 p4d -f -J off -xi >$P4ROOT/stdout 2>$P4ROOT/stderr
19 p4d -f -J off -xi >$P4ROOT/stdout 2>$P4ROOT/stderr
20 p4d -f -J off >$P4ROOT/stdout 2>$P4ROOT/stderr &
20 p4d -f -J off >$P4ROOT/stdout 2>$P4ROOT/stderr &
21 trap "echo % stop the p4 server ; p4 admin stop" EXIT
21 trap "echo % stop the p4 server ; p4 admin stop" EXIT
22
22
23 # wait for the server to initialize
23 # wait for the server to initialize
24 while ! p4 ; do
24 while ! p4 ; do
25 sleep 1
25 sleep 1
26 done >/dev/null 2>/dev/null
26 done >/dev/null 2>/dev/null
27
27
28 echo % create a client spec
28 echo % create a client spec
29 P4CLIENT=hg-p4-import; export P4CLIENT
29 P4CLIENT=hg-p4-import; export P4CLIENT
30 DEPOTPATH=//depot/test-mercurial-import/...
30 DEPOTPATH=//depot/test-mercurial-import/...
31 p4 client -o | sed '/^View:/,$ d' >p4client
31 p4 client -o | sed '/^View:/,$ d' >p4client
32 echo View: >>p4client
32 echo View: >>p4client
33 echo " $DEPOTPATH //$P4CLIENT/..." >>p4client
33 echo " $DEPOTPATH //$P4CLIENT/..." >>p4client
34 p4 client -i <p4client
34 p4 client -i <p4client
35
35
36 echo % populate the depot
36 echo % populate the depot
37 TYPES="text binary symlink"
37 TYPES="text binary symlink"
38 TYPES="$TYPES text+m text+w text+x text+k text+kx text+ko text+l text+C text+D text+F text+S text+S2"
38 TYPES="$TYPES text+m text+w text+x text+k text+kx text+ko text+l text+C text+D text+F text+S text+S2"
39 TYPES="$TYPES binary+k binary+x binary+kx symlink+k"
39 TYPES="$TYPES binary+k binary+x binary+kx symlink+k"
40 TYPES="$TYPES ctext cxtext ktext kxtext ltext tempobj ubinary uxbinary xbinary xltext xtempobj xtext"
40 TYPES="$TYPES ctext cxtext ktext kxtext ltext tempobj ubinary uxbinary xbinary xltext xtempobj xtext"
41 # not testing these
41 # not testing these
42 #TYPES="$TYPES apple resource unicode utf16 uresource xunicode xutf16"
42 #TYPES="$TYPES apple resource unicode utf16 uresource xunicode xutf16"
43 for T in $TYPES ; do
43 for T in $TYPES ; do
44 T2=`echo $T | tr [:upper:] [:lower:]`
44 T2=`echo $T | tr [:upper:] [:lower:]`
45 case $T in
45 case $T in
46 apple)
46 apple)
47 ;;
47 ;;
48 symlink*)
48 symlink*)
49 echo "this is target $T" >target_$T2
49 echo "this is target $T" >target_$T2
50 ln -s target_$T file_$T2
50 ln -s target_$T file_$T2
51 p4 add target_$T2
51 p4 add target_$T2
52 p4 add -t $T file_$T2
52 p4 add -t $T file_$T2
53 ;;
53 ;;
54 binary*)
54 binary*)
55 python -c "file('file_$T2', 'wb').write('this is $T')"
55 python -c "file('file_$T2', 'wb').write('this is $T')"
56 p4 add -t $T file_$T2
56 p4 add -t $T file_$T2
57 ;;
57 ;;
58 *)
58 *)
59 echo "this is $T" >file_$T2
59 echo "this is $T" >file_$T2
60 p4 add -t $T file_$T2
60 p4 add -t $T file_$T2
61 ;;
61 ;;
62 esac
62 esac
63 done
63 done
64 p4 submit -d initial
64 p4 submit -d initial
65
65
66 echo % test keyword expansion
66 echo % test keyword expansion
67 p4 edit file_* target_*
67 p4 edit file_* target_*
68 for T in $TYPES ; do
68 for T in $TYPES ; do
69 T2=`echo $T | tr [:upper:] [:lower:]`
69 T2=`echo $T | tr [:upper:] [:lower:]`
70 echo '$Id$' >>file_$T2
70 echo '$Id$' >>file_$T2
71 echo '$Header$' >>file_$T2
71 echo '$Header$' >>file_$T2
72 echo '$Date$' >>file_$T2
72 echo '$Date$' >>file_$T2
73 echo '$DateTime$' >>file_$T2
73 echo '$DateTime$' >>file_$T2
74 echo '$Change$' >>file_$T2
74 echo '$Change$' >>file_$T2
75 echo '$File$' >>file_$T2
75 echo '$File$' >>file_$T2
76 echo '$Revision$' >>file_$T2
76 echo '$Revision$' >>file_$T2
77 echo '$Header$$Header$Header$' >>file_$T2
77 echo '$Header$$Header$Header$' >>file_$T2
78 done
78 done
79
79
80 ln -s 'target_$Header$' crazy_symlink+k
80 ln -s 'target_$Header$' crazy_symlink+k
81 p4 add -t symlink+k crazy_symlink+k
81 p4 add -t symlink+k crazy_symlink+k
82
82
83 p4 submit -d keywords
83 p4 submit -d keywords
84
84
85 echo % check keywords in p4
85 echo % check keywords in p4
86 grep -H Header file_*
86 grep -H Header file_*
87
87
88 echo % convert
88 echo % convert
89 hg convert -s p4 $DEPOTPATH dst
89 hg convert -s p4 $DEPOTPATH dst
90 hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n'g
90 hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n'g
91
91
92 echo % revision 0
92 echo % revision 0
93 hg -R dst update 0
93 hg -R dst update 0
94 head dst/file_* | cat -v
94 head dst/file_* | cat -v
95
95
96 echo
96 echo
97 echo % revision 1
97 echo % revision 1
98 hg -R dst update 1
98 hg -R dst update 1
99 head dst/file_* | cat -v
99 head dst/file_* | cat -v
100 echo
100 echo
101 echo % crazy_symlink
101 echo % crazy_symlink
102 readlink crazy_symlink+k
102 readlink crazy_symlink+k
103 readlink dst/crazy_symlink+k
103 readlink dst/crazy_symlink+k
104
104
General Comments 0
You need to be logged in to leave comments. Login now