Mercurial > hg
annotate tests/test-convert-p4-filetypes @ 10939:9f6731b03906 stable
convert: mark strings for translation
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Sun, 18 Apr 2010 15:47:49 +0200 |
parents | 3a1f29b63b9f |
children | c326fe884daa |
rev | line source |
---|---|
8829
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
1 #!/bin/sh |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
2 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
3 "$TESTDIR/hghave" p4 execbit symlink || exit 80 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
4 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
5 echo "[extensions]" >> $HGRCPATH |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
6 echo "convert = " >> $HGRCPATH |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
7 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
8 echo % create p4 depot |
10275 | 9 P4ROOT=`pwd`/depot; export P4ROOT |
9042
95046688f80f
tests: remove more instances of export FOO=bar bashism
Brodie Rao <me+hg@dackz.net>
parents:
8829
diff
changeset
|
10 P4AUDIT=$P4ROOT/audit; export P4AUDIT |
95046688f80f
tests: remove more instances of export FOO=bar bashism
Brodie Rao <me+hg@dackz.net>
parents:
8829
diff
changeset
|
11 P4JOURNAL=$P4ROOT/journal; export P4JOURNAL |
95046688f80f
tests: remove more instances of export FOO=bar bashism
Brodie Rao <me+hg@dackz.net>
parents:
8829
diff
changeset
|
12 P4LOG=$P4ROOT/log; export P4LOG |
95046688f80f
tests: remove more instances of export FOO=bar bashism
Brodie Rao <me+hg@dackz.net>
parents:
8829
diff
changeset
|
13 P4PORT=localhost:16661; export P4PORT |
95046688f80f
tests: remove more instances of export FOO=bar bashism
Brodie Rao <me+hg@dackz.net>
parents:
8829
diff
changeset
|
14 P4DEBUG=1; export P4DEBUG |
95046688f80f
tests: remove more instances of export FOO=bar bashism
Brodie Rao <me+hg@dackz.net>
parents:
8829
diff
changeset
|
15 P4CHARSET=utf8; export P4CHARSET |
8829
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
16 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
17 echo % start the p4 server |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
18 [ ! -d $P4ROOT ] && mkdir $P4ROOT |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
19 p4d -f -J off -xi >$P4ROOT/stdout 2>$P4ROOT/stderr |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
20 p4d -f -J off >$P4ROOT/stdout 2>$P4ROOT/stderr & |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
21 trap "echo % stop the p4 server ; p4 admin stop" EXIT |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
22 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
23 # wait for the server to initialize |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
24 while ! p4 ; do |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
25 sleep 1 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
26 done >/dev/null 2>/dev/null |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
27 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
28 echo % create a client spec |
9042
95046688f80f
tests: remove more instances of export FOO=bar bashism
Brodie Rao <me+hg@dackz.net>
parents:
8829
diff
changeset
|
29 P4CLIENT=hg-p4-import; export P4CLIENT |
8829
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
30 DEPOTPATH=//depot/test-mercurial-import/... |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
31 p4 client -o | sed '/^View:/,$ d' >p4client |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
32 echo View: >>p4client |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
33 echo " $DEPOTPATH //$P4CLIENT/..." >>p4client |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
34 p4 client -i <p4client |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
35 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
36 echo % populate the depot |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
37 TYPES="text binary symlink" |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
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" |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
39 TYPES="$TYPES binary+k binary+x binary+kx symlink+k" |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
40 TYPES="$TYPES ctext cxtext ktext kxtext ltext tempobj ubinary uxbinary xbinary xltext xtempobj xtext" |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
41 # not testing these |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
42 #TYPES="$TYPES apple resource unicode utf16 uresource xunicode xutf16" |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
43 for T in $TYPES ; do |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
44 T2=`echo $T | tr [:upper:] [:lower:]` |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
45 case $T in |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
46 apple) |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
47 ;; |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
48 symlink*) |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
49 echo "this is target $T" >target_$T2 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
50 ln -s target_$T file_$T2 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
51 p4 add target_$T2 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
52 p4 add -t $T file_$T2 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
53 ;; |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
54 binary*) |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
55 python -c "file('file_$T2', 'wb').write('this is $T')" |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
56 p4 add -t $T file_$T2 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
57 ;; |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
58 *) |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
59 echo "this is $T" >file_$T2 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
60 p4 add -t $T file_$T2 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
61 ;; |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
62 esac |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
63 done |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
64 p4 submit -d initial |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
65 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
66 echo % test keyword expansion |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
67 p4 edit file_* target_* |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
68 for T in $TYPES ; do |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
69 T2=`echo $T | tr [:upper:] [:lower:]` |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
70 echo '$Id$' >>file_$T2 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
71 echo '$Header$' >>file_$T2 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
72 echo '$Date$' >>file_$T2 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
73 echo '$DateTime$' >>file_$T2 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
74 echo '$Change$' >>file_$T2 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
75 echo '$File$' >>file_$T2 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
76 echo '$Revision$' >>file_$T2 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
77 echo '$Header$$Header$Header$' >>file_$T2 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
78 done |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
79 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
80 ln -s 'target_$Header$' crazy_symlink+k |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
81 p4 add -t symlink+k crazy_symlink+k |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
82 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
83 p4 submit -d keywords |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
84 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
85 echo % check keywords in p4 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
86 grep -H Header file_* |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
87 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
88 echo % convert |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
89 hg convert -s p4 $DEPOTPATH dst |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
90 hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n'g |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
91 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
92 echo % revision 0 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
93 hg -R dst update 0 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
94 head dst/file_* | cat -v |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
95 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
96 echo |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
97 echo % revision 1 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
98 hg -R dst update 1 |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
99 head dst/file_* | cat -v |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
100 echo |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
101 echo % crazy_symlink |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
102 readlink crazy_symlink+k |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
103 readlink dst/crazy_symlink+k |
ce4b92f5cea7
convert: Make P4 conversion cope with keywords, binary files and symbolic links.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
104 |