Show More
@@ -0,0 +1,104 b'' | |||
|
1 | #!/bin/sh | |
|
2 | ||
|
3 | "$TESTDIR/hghave" p4 execbit symlink || exit 80 | |
|
4 | ||
|
5 | echo "[extensions]" >> $HGRCPATH | |
|
6 | echo "convert = " >> $HGRCPATH | |
|
7 | ||
|
8 | echo % create p4 depot | |
|
9 | export P4ROOT=$PWD/depot | |
|
10 | export P4AUDIT=$P4ROOT/audit | |
|
11 | export P4JOURNAL=$P4ROOT/journal | |
|
12 | export P4LOG=$P4ROOT/log | |
|
13 | export P4PORT=localhost:16661 | |
|
14 | export P4DEBUG=1 | |
|
15 | export P4CHARSET=utf8 | |
|
16 | ||
|
17 | echo % start the p4 server | |
|
18 | [ ! -d $P4ROOT ] && mkdir $P4ROOT | |
|
19 | p4d -f -J off -xi >$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 | |
|
22 | ||
|
23 | # wait for the server to initialize | |
|
24 | while ! p4 ; do | |
|
25 | sleep 1 | |
|
26 | done >/dev/null 2>/dev/null | |
|
27 | ||
|
28 | echo % create a client spec | |
|
29 | export P4CLIENT=hg-p4-import | |
|
30 | DEPOTPATH=//depot/test-mercurial-import/... | |
|
31 | p4 client -o | sed '/^View:/,$ d' >p4client | |
|
32 | echo View: >>p4client | |
|
33 | echo " $DEPOTPATH //$P4CLIENT/..." >>p4client | |
|
34 | p4 client -i <p4client | |
|
35 | ||
|
36 | echo % populate the depot | |
|
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" | |
|
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" | |
|
41 | # not testing these | |
|
42 | #TYPES="$TYPES apple resource unicode utf16 uresource xunicode xutf16" | |
|
43 | for T in $TYPES ; do | |
|
44 | T2=`echo $T | tr [:upper:] [:lower:]` | |
|
45 | case $T in | |
|
46 | apple) | |
|
47 | ;; | |
|
48 | symlink*) | |
|
49 | echo "this is target $T" >target_$T2 | |
|
50 | ln -s target_$T file_$T2 | |
|
51 | p4 add target_$T2 | |
|
52 | p4 add -t $T file_$T2 | |
|
53 | ;; | |
|
54 | binary*) | |
|
55 | python -c "file('file_$T2', 'wb').write('this is $T')" | |
|
56 | p4 add -t $T file_$T2 | |
|
57 | ;; | |
|
58 | *) | |
|
59 | echo "this is $T" >file_$T2 | |
|
60 | p4 add -t $T file_$T2 | |
|
61 | ;; | |
|
62 | esac | |
|
63 | done | |
|
64 | p4 submit -d initial | |
|
65 | ||
|
66 | echo % test keyword expansion | |
|
67 | p4 edit file_* target_* | |
|
68 | for T in $TYPES ; do | |
|
69 | T2=`echo $T | tr [:upper:] [:lower:]` | |
|
70 | echo '$Id$' >>file_$T2 | |
|
71 | echo '$Header$' >>file_$T2 | |
|
72 | echo '$Date$' >>file_$T2 | |
|
73 | echo '$DateTime$' >>file_$T2 | |
|
74 | echo '$Change$' >>file_$T2 | |
|
75 | echo '$File$' >>file_$T2 | |
|
76 | echo '$Revision$' >>file_$T2 | |
|
77 | echo '$Header$$Header$Header$' >>file_$T2 | |
|
78 | done | |
|
79 | ||
|
80 | ln -s 'target_$Header$' crazy_symlink+k | |
|
81 | p4 add -t symlink+k crazy_symlink+k | |
|
82 | ||
|
83 | p4 submit -d keywords | |
|
84 | ||
|
85 | echo % check keywords in p4 | |
|
86 | grep -H Header file_* | |
|
87 | ||
|
88 | echo % convert | |
|
89 | hg convert -s p4 $DEPOTPATH dst | |
|
90 | hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n'g | |
|
91 | ||
|
92 | echo % revision 0 | |
|
93 | hg -R dst update 0 | |
|
94 | head dst/file_* | cat -v | |
|
95 | ||
|
96 | echo | |
|
97 | echo % revision 1 | |
|
98 | hg -R dst update 1 | |
|
99 | head dst/file_* | cat -v | |
|
100 | echo | |
|
101 | echo % crazy_symlink | |
|
102 | readlink crazy_symlink+k | |
|
103 | readlink dst/crazy_symlink+k | |
|
104 |
This diff has been collapsed as it changes many lines, (642 lines changed) Show them Hide them | |||
@@ -0,0 +1,642 b'' | |||
|
1 | % create p4 depot | |
|
2 | % start the p4 server | |
|
3 | % create a client spec | |
|
4 | Client hg-p4-import saved. | |
|
5 | % populate the depot | |
|
6 | //depot/test-mercurial-import/file_text#1 - opened for add | |
|
7 | //depot/test-mercurial-import/file_binary#1 - opened for add | |
|
8 | //depot/test-mercurial-import/target_symlink#1 - opened for add | |
|
9 | //depot/test-mercurial-import/file_symlink#1 - opened for add | |
|
10 | //depot/test-mercurial-import/file_text+m#1 - opened for add | |
|
11 | //depot/test-mercurial-import/file_text+w#1 - opened for add | |
|
12 | //depot/test-mercurial-import/file_text+x#1 - opened for add | |
|
13 | //depot/test-mercurial-import/file_text+k#1 - opened for add | |
|
14 | //depot/test-mercurial-import/file_text+kx#1 - opened for add | |
|
15 | //depot/test-mercurial-import/file_text+ko#1 - opened for add | |
|
16 | //depot/test-mercurial-import/file_text+l#1 - opened for add | |
|
17 | //depot/test-mercurial-import/file_text+c#1 - opened for add | |
|
18 | //depot/test-mercurial-import/file_text+d#1 - opened for add | |
|
19 | //depot/test-mercurial-import/file_text+f#1 - opened for add | |
|
20 | //depot/test-mercurial-import/file_text+s#1 - opened for add | |
|
21 | //depot/test-mercurial-import/file_text+s2#1 - opened for add | |
|
22 | //depot/test-mercurial-import/file_binary+k#1 - opened for add | |
|
23 | //depot/test-mercurial-import/file_binary+x#1 - opened for add | |
|
24 | //depot/test-mercurial-import/file_binary+kx#1 - opened for add | |
|
25 | //depot/test-mercurial-import/target_symlink+k#1 - opened for add | |
|
26 | //depot/test-mercurial-import/file_symlink+k#1 - opened for add | |
|
27 | //depot/test-mercurial-import/file_ctext#1 - opened for add | |
|
28 | //depot/test-mercurial-import/file_cxtext#1 - opened for add | |
|
29 | //depot/test-mercurial-import/file_ktext#1 - opened for add | |
|
30 | //depot/test-mercurial-import/file_kxtext#1 - opened for add | |
|
31 | //depot/test-mercurial-import/file_ltext#1 - opened for add | |
|
32 | //depot/test-mercurial-import/file_tempobj#1 - opened for add | |
|
33 | //depot/test-mercurial-import/file_ubinary#1 - opened for add | |
|
34 | //depot/test-mercurial-import/file_uxbinary#1 - opened for add | |
|
35 | //depot/test-mercurial-import/file_xbinary#1 - opened for add | |
|
36 | //depot/test-mercurial-import/file_xltext#1 - opened for add | |
|
37 | //depot/test-mercurial-import/file_xtempobj#1 - opened for add | |
|
38 | //depot/test-mercurial-import/file_xtext#1 - opened for add | |
|
39 | Submitting change 1. | |
|
40 | Locking 33 files ... | |
|
41 | add //depot/test-mercurial-import/file_binary#1 | |
|
42 | add //depot/test-mercurial-import/file_binary+k#1 | |
|
43 | add //depot/test-mercurial-import/file_binary+kx#1 | |
|
44 | add //depot/test-mercurial-import/file_binary+x#1 | |
|
45 | add //depot/test-mercurial-import/file_ctext#1 | |
|
46 | add //depot/test-mercurial-import/file_cxtext#1 | |
|
47 | add //depot/test-mercurial-import/file_ktext#1 | |
|
48 | add //depot/test-mercurial-import/file_kxtext#1 | |
|
49 | add //depot/test-mercurial-import/file_ltext#1 | |
|
50 | add //depot/test-mercurial-import/file_symlink#1 | |
|
51 | add //depot/test-mercurial-import/file_symlink+k#1 | |
|
52 | add //depot/test-mercurial-import/file_tempobj#1 | |
|
53 | add //depot/test-mercurial-import/file_text#1 | |
|
54 | add //depot/test-mercurial-import/file_text+c#1 | |
|
55 | add //depot/test-mercurial-import/file_text+d#1 | |
|
56 | add //depot/test-mercurial-import/file_text+f#1 | |
|
57 | add //depot/test-mercurial-import/file_text+k#1 | |
|
58 | add //depot/test-mercurial-import/file_text+ko#1 | |
|
59 | add //depot/test-mercurial-import/file_text+kx#1 | |
|
60 | add //depot/test-mercurial-import/file_text+l#1 | |
|
61 | add //depot/test-mercurial-import/file_text+m#1 | |
|
62 | add //depot/test-mercurial-import/file_text+s#1 | |
|
63 | add //depot/test-mercurial-import/file_text+s2#1 | |
|
64 | add //depot/test-mercurial-import/file_text+w#1 | |
|
65 | add //depot/test-mercurial-import/file_text+x#1 | |
|
66 | add //depot/test-mercurial-import/file_ubinary#1 | |
|
67 | add //depot/test-mercurial-import/file_uxbinary#1 | |
|
68 | add //depot/test-mercurial-import/file_xbinary#1 | |
|
69 | add //depot/test-mercurial-import/file_xltext#1 | |
|
70 | add //depot/test-mercurial-import/file_xtempobj#1 | |
|
71 | add //depot/test-mercurial-import/file_xtext#1 | |
|
72 | add //depot/test-mercurial-import/target_symlink#1 | |
|
73 | add //depot/test-mercurial-import/target_symlink+k#1 | |
|
74 | Change 1 submitted. | |
|
75 | //depot/test-mercurial-import/file_binary+k#1 - refreshing | |
|
76 | //depot/test-mercurial-import/file_binary+kx#1 - refreshing | |
|
77 | //depot/test-mercurial-import/file_ktext#1 - refreshing | |
|
78 | //depot/test-mercurial-import/file_kxtext#1 - refreshing | |
|
79 | //depot/test-mercurial-import/file_symlink+k#1 - refreshing | |
|
80 | //depot/test-mercurial-import/file_text+k#1 - refreshing | |
|
81 | //depot/test-mercurial-import/file_text+ko#1 - refreshing | |
|
82 | //depot/test-mercurial-import/file_text+kx#1 - refreshing | |
|
83 | % test keyword expansion | |
|
84 | //depot/test-mercurial-import/file_binary#1 - opened for edit | |
|
85 | //depot/test-mercurial-import/file_binary+k#1 - opened for edit | |
|
86 | //depot/test-mercurial-import/file_binary+kx#1 - opened for edit | |
|
87 | //depot/test-mercurial-import/file_binary+x#1 - opened for edit | |
|
88 | //depot/test-mercurial-import/file_ctext#1 - opened for edit | |
|
89 | //depot/test-mercurial-import/file_cxtext#1 - opened for edit | |
|
90 | //depot/test-mercurial-import/file_ktext#1 - opened for edit | |
|
91 | //depot/test-mercurial-import/file_kxtext#1 - opened for edit | |
|
92 | //depot/test-mercurial-import/file_ltext#1 - opened for edit | |
|
93 | //depot/test-mercurial-import/file_symlink#1 - opened for edit | |
|
94 | //depot/test-mercurial-import/file_symlink+k#1 - opened for edit | |
|
95 | //depot/test-mercurial-import/file_tempobj#1 - opened for edit | |
|
96 | //depot/test-mercurial-import/file_text#1 - opened for edit | |
|
97 | //depot/test-mercurial-import/file_text+c#1 - opened for edit | |
|
98 | //depot/test-mercurial-import/file_text+d#1 - opened for edit | |
|
99 | //depot/test-mercurial-import/file_text+f#1 - opened for edit | |
|
100 | //depot/test-mercurial-import/file_text+k#1 - opened for edit | |
|
101 | //depot/test-mercurial-import/file_text+ko#1 - opened for edit | |
|
102 | //depot/test-mercurial-import/file_text+kx#1 - opened for edit | |
|
103 | //depot/test-mercurial-import/file_text+l#1 - opened for edit | |
|
104 | //depot/test-mercurial-import/file_text+m#1 - opened for edit | |
|
105 | //depot/test-mercurial-import/file_text+s#1 - opened for edit | |
|
106 | //depot/test-mercurial-import/file_text+s2#1 - opened for edit | |
|
107 | //depot/test-mercurial-import/file_text+w#1 - opened for edit | |
|
108 | //depot/test-mercurial-import/file_text+x#1 - opened for edit | |
|
109 | //depot/test-mercurial-import/file_ubinary#1 - opened for edit | |
|
110 | //depot/test-mercurial-import/file_uxbinary#1 - opened for edit | |
|
111 | //depot/test-mercurial-import/file_xbinary#1 - opened for edit | |
|
112 | //depot/test-mercurial-import/file_xltext#1 - opened for edit | |
|
113 | //depot/test-mercurial-import/file_xtempobj#1 - opened for edit | |
|
114 | //depot/test-mercurial-import/file_xtext#1 - opened for edit | |
|
115 | //depot/test-mercurial-import/target_symlink#1 - opened for edit | |
|
116 | //depot/test-mercurial-import/target_symlink+k#1 - opened for edit | |
|
117 | //depot/test-mercurial-import/crazy_symlink+k#1 - opened for add | |
|
118 | Submitting change 2. | |
|
119 | Locking 34 files ... | |
|
120 | add //depot/test-mercurial-import/crazy_symlink+k#1 | |
|
121 | edit //depot/test-mercurial-import/file_binary#2 | |
|
122 | edit //depot/test-mercurial-import/file_binary+k#2 | |
|
123 | edit //depot/test-mercurial-import/file_binary+kx#2 | |
|
124 | edit //depot/test-mercurial-import/file_binary+x#2 | |
|
125 | edit //depot/test-mercurial-import/file_ctext#2 | |
|
126 | edit //depot/test-mercurial-import/file_cxtext#2 | |
|
127 | edit //depot/test-mercurial-import/file_ktext#2 | |
|
128 | edit //depot/test-mercurial-import/file_kxtext#2 | |
|
129 | edit //depot/test-mercurial-import/file_ltext#2 | |
|
130 | edit //depot/test-mercurial-import/file_symlink#2 | |
|
131 | edit //depot/test-mercurial-import/file_symlink+k#2 | |
|
132 | edit //depot/test-mercurial-import/file_tempobj#2 | |
|
133 | edit //depot/test-mercurial-import/file_text#2 | |
|
134 | edit //depot/test-mercurial-import/file_text+c#2 | |
|
135 | edit //depot/test-mercurial-import/file_text+d#2 | |
|
136 | edit //depot/test-mercurial-import/file_text+f#2 | |
|
137 | edit //depot/test-mercurial-import/file_text+k#2 | |
|
138 | edit //depot/test-mercurial-import/file_text+ko#2 | |
|
139 | edit //depot/test-mercurial-import/file_text+kx#2 | |
|
140 | edit //depot/test-mercurial-import/file_text+l#2 | |
|
141 | edit //depot/test-mercurial-import/file_text+m#2 | |
|
142 | edit //depot/test-mercurial-import/file_text+s#2 | |
|
143 | edit //depot/test-mercurial-import/file_text+s2#2 | |
|
144 | edit //depot/test-mercurial-import/file_text+w#2 | |
|
145 | edit //depot/test-mercurial-import/file_text+x#2 | |
|
146 | edit //depot/test-mercurial-import/file_ubinary#2 | |
|
147 | edit //depot/test-mercurial-import/file_uxbinary#2 | |
|
148 | edit //depot/test-mercurial-import/file_xbinary#2 | |
|
149 | edit //depot/test-mercurial-import/file_xltext#2 | |
|
150 | edit //depot/test-mercurial-import/file_xtempobj#2 | |
|
151 | edit //depot/test-mercurial-import/file_xtext#2 | |
|
152 | edit //depot/test-mercurial-import/target_symlink#2 | |
|
153 | edit //depot/test-mercurial-import/target_symlink+k#2 | |
|
154 | Change 2 submitted. | |
|
155 | //depot/test-mercurial-import/crazy_symlink+k#1 - refreshing | |
|
156 | //depot/test-mercurial-import/file_binary+k#2 - refreshing | |
|
157 | //depot/test-mercurial-import/file_binary+kx#2 - refreshing | |
|
158 | //depot/test-mercurial-import/file_ktext#2 - refreshing | |
|
159 | //depot/test-mercurial-import/file_kxtext#2 - refreshing | |
|
160 | //depot/test-mercurial-import/file_symlink+k#2 - refreshing | |
|
161 | //depot/test-mercurial-import/file_text+k#2 - refreshing | |
|
162 | //depot/test-mercurial-import/file_text+ko#2 - refreshing | |
|
163 | //depot/test-mercurial-import/file_text+kx#2 - refreshing | |
|
164 | % check keywords in p4 | |
|
165 | file_binary:$Header$ | |
|
166 | file_binary:$Header$$Header$Header$ | |
|
167 | file_binary+k:$Header: //depot/test-mercurial-import/file_binary+k#2 $ | |
|
168 | file_binary+k:$Header: //depot/test-mercurial-import/file_binary+k#2 $$Header: //depot/test-mercurial-import/file_binary+k#2 $Header$ | |
|
169 | file_binary+kx:$Header: //depot/test-mercurial-import/file_binary+kx#2 $ | |
|
170 | file_binary+kx:$Header: //depot/test-mercurial-import/file_binary+kx#2 $$Header: //depot/test-mercurial-import/file_binary+kx#2 $Header$ | |
|
171 | file_binary+x:$Header$ | |
|
172 | file_binary+x:$Header$$Header$Header$ | |
|
173 | file_ctext:$Header$ | |
|
174 | file_ctext:$Header$$Header$Header$ | |
|
175 | file_cxtext:$Header$ | |
|
176 | file_cxtext:$Header$$Header$Header$ | |
|
177 | file_ktext:$Header: //depot/test-mercurial-import/file_ktext#2 $ | |
|
178 | file_ktext:$Header: //depot/test-mercurial-import/file_ktext#2 $$Header: //depot/test-mercurial-import/file_ktext#2 $Header$ | |
|
179 | file_kxtext:$Header: //depot/test-mercurial-import/file_kxtext#2 $ | |
|
180 | file_kxtext:$Header: //depot/test-mercurial-import/file_kxtext#2 $$Header: //depot/test-mercurial-import/file_kxtext#2 $Header$ | |
|
181 | file_ltext:$Header$ | |
|
182 | file_ltext:$Header$$Header$Header$ | |
|
183 | file_symlink:$Header$ | |
|
184 | file_symlink:$Header$$Header$Header$ | |
|
185 | file_symlink+k:$Header$ | |
|
186 | file_symlink+k:$Header$$Header$Header$ | |
|
187 | file_tempobj:$Header$ | |
|
188 | file_tempobj:$Header$$Header$Header$ | |
|
189 | file_text:$Header$ | |
|
190 | file_text:$Header$$Header$Header$ | |
|
191 | file_text+c:$Header$ | |
|
192 | file_text+c:$Header$$Header$Header$ | |
|
193 | file_text+d:$Header$ | |
|
194 | file_text+d:$Header$$Header$Header$ | |
|
195 | file_text+f:$Header$ | |
|
196 | file_text+f:$Header$$Header$Header$ | |
|
197 | file_text+k:$Header: //depot/test-mercurial-import/file_text+k#2 $ | |
|
198 | file_text+k:$Header: //depot/test-mercurial-import/file_text+k#2 $$Header: //depot/test-mercurial-import/file_text+k#2 $Header$ | |
|
199 | file_text+ko:$Header: //depot/test-mercurial-import/file_text+ko#2 $ | |
|
200 | file_text+ko:$Header: //depot/test-mercurial-import/file_text+ko#2 $$Header: //depot/test-mercurial-import/file_text+ko#2 $Header$ | |
|
201 | file_text+kx:$Header: //depot/test-mercurial-import/file_text+kx#2 $ | |
|
202 | file_text+kx:$Header: //depot/test-mercurial-import/file_text+kx#2 $$Header: //depot/test-mercurial-import/file_text+kx#2 $Header$ | |
|
203 | file_text+l:$Header$ | |
|
204 | file_text+l:$Header$$Header$Header$ | |
|
205 | file_text+m:$Header$ | |
|
206 | file_text+m:$Header$$Header$Header$ | |
|
207 | file_text+s:$Header$ | |
|
208 | file_text+s:$Header$$Header$Header$ | |
|
209 | file_text+s2:$Header$ | |
|
210 | file_text+s2:$Header$$Header$Header$ | |
|
211 | file_text+w:$Header$ | |
|
212 | file_text+w:$Header$$Header$Header$ | |
|
213 | file_text+x:$Header$ | |
|
214 | file_text+x:$Header$$Header$Header$ | |
|
215 | file_ubinary:$Header$ | |
|
216 | file_ubinary:$Header$$Header$Header$ | |
|
217 | file_uxbinary:$Header$ | |
|
218 | file_uxbinary:$Header$$Header$Header$ | |
|
219 | file_xbinary:$Header$ | |
|
220 | file_xbinary:$Header$$Header$Header$ | |
|
221 | file_xltext:$Header$ | |
|
222 | file_xltext:$Header$$Header$Header$ | |
|
223 | file_xtempobj:$Header$ | |
|
224 | file_xtempobj:$Header$$Header$Header$ | |
|
225 | file_xtext:$Header$ | |
|
226 | file_xtext:$Header$$Header$Header$ | |
|
227 | % convert | |
|
228 | initializing destination dst repository | |
|
229 | reading p4 views | |
|
230 | collecting p4 changelists | |
|
231 | 1 initial | |
|
232 | 2 keywords | |
|
233 | scanning source... | |
|
234 | sorting... | |
|
235 | converting... | |
|
236 | 1 initial | |
|
237 | 0 keywords | |
|
238 | rev=1 desc="keywords" tags="tip" files="crazy_symlink+k file_binary file_binary+k file_binary+kx file_binary+x file_ctext file_cxtext file_ktext file_kxtext file_ltext file_text file_text+c file_text+d file_text+f file_text+k file_text+ko file_text+kx file_text+l file_text+m file_text+s file_text+s2 file_text+w file_text+x file_ubinary file_uxbinary file_xbinary file_xltext file_xtext target_symlink target_symlink+k" | |
|
239 | grev=0 desc="initial" tags="" files="file_binary file_binary+k file_binary+kx file_binary+x file_ctext file_cxtext file_ktext file_kxtext file_ltext file_symlink file_symlink+k file_text file_text+c file_text+d file_text+f file_text+k file_text+ko file_text+kx file_text+l file_text+m file_text+s2 file_text+w file_text+x file_ubinary file_uxbinary file_xbinary file_xltext file_xtext target_symlink target_symlink+k" | |
|
240 | g% revision 0 | |
|
241 | 30 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
242 | ==> dst/file_binary <== | |
|
243 | this is binary | |
|
244 | ==> dst/file_binary+k <== | |
|
245 | this is binary+k | |
|
246 | ==> dst/file_binary+kx <== | |
|
247 | this is binary+kx | |
|
248 | ==> dst/file_binary+x <== | |
|
249 | this is binary+x | |
|
250 | ==> dst/file_ctext <== | |
|
251 | this is ctext | |
|
252 | ||
|
253 | ==> dst/file_cxtext <== | |
|
254 | this is cxtext | |
|
255 | ||
|
256 | ==> dst/file_ktext <== | |
|
257 | this is ktext | |
|
258 | ||
|
259 | ==> dst/file_kxtext <== | |
|
260 | this is kxtext | |
|
261 | ||
|
262 | ==> dst/file_ltext <== | |
|
263 | this is ltext | |
|
264 | ||
|
265 | ==> dst/file_symlink <== | |
|
266 | this is target symlink | |
|
267 | ||
|
268 | ==> dst/file_symlink+k <== | |
|
269 | this is target symlink+k | |
|
270 | ||
|
271 | ==> dst/file_text <== | |
|
272 | this is text | |
|
273 | ||
|
274 | ==> dst/file_text+c <== | |
|
275 | this is text+C | |
|
276 | ||
|
277 | ==> dst/file_text+d <== | |
|
278 | this is text+D | |
|
279 | ||
|
280 | ==> dst/file_text+f <== | |
|
281 | this is text+F | |
|
282 | ||
|
283 | ==> dst/file_text+k <== | |
|
284 | this is text+k | |
|
285 | ||
|
286 | ==> dst/file_text+ko <== | |
|
287 | this is text+ko | |
|
288 | ||
|
289 | ==> dst/file_text+kx <== | |
|
290 | this is text+kx | |
|
291 | ||
|
292 | ==> dst/file_text+l <== | |
|
293 | this is text+l | |
|
294 | ||
|
295 | ==> dst/file_text+m <== | |
|
296 | this is text+m | |
|
297 | ||
|
298 | ==> dst/file_text+s2 <== | |
|
299 | this is text+S2 | |
|
300 | ||
|
301 | ==> dst/file_text+w <== | |
|
302 | this is text+w | |
|
303 | ||
|
304 | ==> dst/file_text+x <== | |
|
305 | this is text+x | |
|
306 | ||
|
307 | ==> dst/file_ubinary <== | |
|
308 | this is ubinary | |
|
309 | ||
|
310 | ==> dst/file_uxbinary <== | |
|
311 | this is uxbinary | |
|
312 | ||
|
313 | ==> dst/file_xbinary <== | |
|
314 | this is xbinary | |
|
315 | ||
|
316 | ==> dst/file_xltext <== | |
|
317 | this is xltext | |
|
318 | ||
|
319 | ==> dst/file_xtext <== | |
|
320 | this is xtext | |
|
321 | ||
|
322 | % revision 1 | |
|
323 | 30 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
324 | ==> dst/file_binary <== | |
|
325 | this is binary$Id$ | |
|
326 | $Header$ | |
|
327 | $Date$ | |
|
328 | $DateTime$ | |
|
329 | $Change$ | |
|
330 | $File$ | |
|
331 | $Revision$ | |
|
332 | $Header$$Header$Header$ | |
|
333 | ||
|
334 | ==> dst/file_binary+k <== | |
|
335 | this is binary+k$Id$ | |
|
336 | $Header$ | |
|
337 | $Date$ | |
|
338 | $DateTime$ | |
|
339 | $Change$ | |
|
340 | $File$ | |
|
341 | $Revision$ | |
|
342 | $Header$$Header$Header$ | |
|
343 | ||
|
344 | ==> dst/file_binary+kx <== | |
|
345 | this is binary+kx$Id$ | |
|
346 | $Header$ | |
|
347 | $Date$ | |
|
348 | $DateTime$ | |
|
349 | $Change$ | |
|
350 | $File$ | |
|
351 | $Revision$ | |
|
352 | $Header$$Header$Header$ | |
|
353 | ||
|
354 | ==> dst/file_binary+x <== | |
|
355 | this is binary+x$Id$ | |
|
356 | $Header$ | |
|
357 | $Date$ | |
|
358 | $DateTime$ | |
|
359 | $Change$ | |
|
360 | $File$ | |
|
361 | $Revision$ | |
|
362 | $Header$$Header$Header$ | |
|
363 | ||
|
364 | ==> dst/file_ctext <== | |
|
365 | this is ctext | |
|
366 | $Id$ | |
|
367 | $Header$ | |
|
368 | $Date$ | |
|
369 | $DateTime$ | |
|
370 | $Change$ | |
|
371 | $File$ | |
|
372 | $Revision$ | |
|
373 | $Header$$Header$Header$ | |
|
374 | ||
|
375 | ==> dst/file_cxtext <== | |
|
376 | this is cxtext | |
|
377 | $Id$ | |
|
378 | $Header$ | |
|
379 | $Date$ | |
|
380 | $DateTime$ | |
|
381 | $Change$ | |
|
382 | $File$ | |
|
383 | $Revision$ | |
|
384 | $Header$$Header$Header$ | |
|
385 | ||
|
386 | ==> dst/file_ktext <== | |
|
387 | this is ktext | |
|
388 | $Id$ | |
|
389 | $Header$ | |
|
390 | $Date$ | |
|
391 | $DateTime$ | |
|
392 | $Change$ | |
|
393 | $File$ | |
|
394 | $Revision$ | |
|
395 | $Header$$Header$Header$ | |
|
396 | ||
|
397 | ==> dst/file_kxtext <== | |
|
398 | this is kxtext | |
|
399 | $Id$ | |
|
400 | $Header$ | |
|
401 | $Date$ | |
|
402 | $DateTime$ | |
|
403 | $Change$ | |
|
404 | $File$ | |
|
405 | $Revision$ | |
|
406 | $Header$$Header$Header$ | |
|
407 | ||
|
408 | ==> dst/file_ltext <== | |
|
409 | this is ltext | |
|
410 | $Id$ | |
|
411 | $Header$ | |
|
412 | $Date$ | |
|
413 | $DateTime$ | |
|
414 | $Change$ | |
|
415 | $File$ | |
|
416 | $Revision$ | |
|
417 | $Header$$Header$Header$ | |
|
418 | ||
|
419 | ==> dst/file_symlink <== | |
|
420 | this is target symlink | |
|
421 | $Id$ | |
|
422 | $Header$ | |
|
423 | $Date$ | |
|
424 | $DateTime$ | |
|
425 | $Change$ | |
|
426 | $File$ | |
|
427 | $Revision$ | |
|
428 | $Header$$Header$Header$ | |
|
429 | ||
|
430 | ==> dst/file_symlink+k <== | |
|
431 | this is target symlink+k | |
|
432 | $Id$ | |
|
433 | $Header$ | |
|
434 | $Date$ | |
|
435 | $DateTime$ | |
|
436 | $Change$ | |
|
437 | $File$ | |
|
438 | $Revision$ | |
|
439 | $Header$$Header$Header$ | |
|
440 | ||
|
441 | ==> dst/file_text <== | |
|
442 | this is text | |
|
443 | $Id$ | |
|
444 | $Header$ | |
|
445 | $Date$ | |
|
446 | $DateTime$ | |
|
447 | $Change$ | |
|
448 | $File$ | |
|
449 | $Revision$ | |
|
450 | $Header$$Header$Header$ | |
|
451 | ||
|
452 | ==> dst/file_text+c <== | |
|
453 | this is text+C | |
|
454 | $Id$ | |
|
455 | $Header$ | |
|
456 | $Date$ | |
|
457 | $DateTime$ | |
|
458 | $Change$ | |
|
459 | $File$ | |
|
460 | $Revision$ | |
|
461 | $Header$$Header$Header$ | |
|
462 | ||
|
463 | ==> dst/file_text+d <== | |
|
464 | this is text+D | |
|
465 | $Id$ | |
|
466 | $Header$ | |
|
467 | $Date$ | |
|
468 | $DateTime$ | |
|
469 | $Change$ | |
|
470 | $File$ | |
|
471 | $Revision$ | |
|
472 | $Header$$Header$Header$ | |
|
473 | ||
|
474 | ==> dst/file_text+f <== | |
|
475 | this is text+F | |
|
476 | $Id$ | |
|
477 | $Header$ | |
|
478 | $Date$ | |
|
479 | $DateTime$ | |
|
480 | $Change$ | |
|
481 | $File$ | |
|
482 | $Revision$ | |
|
483 | $Header$$Header$Header$ | |
|
484 | ||
|
485 | ==> dst/file_text+k <== | |
|
486 | this is text+k | |
|
487 | $Id$ | |
|
488 | $Header$ | |
|
489 | $Date$ | |
|
490 | $DateTime$ | |
|
491 | $Change$ | |
|
492 | $File$ | |
|
493 | $Revision$ | |
|
494 | $Header$$Header$Header$ | |
|
495 | ||
|
496 | ==> dst/file_text+ko <== | |
|
497 | this is text+ko | |
|
498 | $Id$ | |
|
499 | $Header$ | |
|
500 | $Date$ | |
|
501 | $DateTime$ | |
|
502 | $Change$ | |
|
503 | $File$ | |
|
504 | $Revision$ | |
|
505 | $Header$$Header$Header$ | |
|
506 | ||
|
507 | ==> dst/file_text+kx <== | |
|
508 | this is text+kx | |
|
509 | $Id$ | |
|
510 | $Header$ | |
|
511 | $Date$ | |
|
512 | $DateTime$ | |
|
513 | $Change$ | |
|
514 | $File$ | |
|
515 | $Revision$ | |
|
516 | $Header$$Header$Header$ | |
|
517 | ||
|
518 | ==> dst/file_text+l <== | |
|
519 | this is text+l | |
|
520 | $Id$ | |
|
521 | $Header$ | |
|
522 | $Date$ | |
|
523 | $DateTime$ | |
|
524 | $Change$ | |
|
525 | $File$ | |
|
526 | $Revision$ | |
|
527 | $Header$$Header$Header$ | |
|
528 | ||
|
529 | ==> dst/file_text+m <== | |
|
530 | this is text+m | |
|
531 | $Id$ | |
|
532 | $Header$ | |
|
533 | $Date$ | |
|
534 | $DateTime$ | |
|
535 | $Change$ | |
|
536 | $File$ | |
|
537 | $Revision$ | |
|
538 | $Header$$Header$Header$ | |
|
539 | ||
|
540 | ==> dst/file_text+s <== | |
|
541 | this is text+S | |
|
542 | $Id$ | |
|
543 | $Header$ | |
|
544 | $Date$ | |
|
545 | $DateTime$ | |
|
546 | $Change$ | |
|
547 | $File$ | |
|
548 | $Revision$ | |
|
549 | $Header$$Header$Header$ | |
|
550 | ||
|
551 | ==> dst/file_text+s2 <== | |
|
552 | this is text+S2 | |
|
553 | $Id$ | |
|
554 | $Header$ | |
|
555 | $Date$ | |
|
556 | $DateTime$ | |
|
557 | $Change$ | |
|
558 | $File$ | |
|
559 | $Revision$ | |
|
560 | $Header$$Header$Header$ | |
|
561 | ||
|
562 | ==> dst/file_text+w <== | |
|
563 | this is text+w | |
|
564 | $Id$ | |
|
565 | $Header$ | |
|
566 | $Date$ | |
|
567 | $DateTime$ | |
|
568 | $Change$ | |
|
569 | $File$ | |
|
570 | $Revision$ | |
|
571 | $Header$$Header$Header$ | |
|
572 | ||
|
573 | ==> dst/file_text+x <== | |
|
574 | this is text+x | |
|
575 | $Id$ | |
|
576 | $Header$ | |
|
577 | $Date$ | |
|
578 | $DateTime$ | |
|
579 | $Change$ | |
|
580 | $File$ | |
|
581 | $Revision$ | |
|
582 | $Header$$Header$Header$ | |
|
583 | ||
|
584 | ==> dst/file_ubinary <== | |
|
585 | this is ubinary | |
|
586 | $Id$ | |
|
587 | $Header$ | |
|
588 | $Date$ | |
|
589 | $DateTime$ | |
|
590 | $Change$ | |
|
591 | $File$ | |
|
592 | $Revision$ | |
|
593 | $Header$$Header$Header$ | |
|
594 | ||
|
595 | ==> dst/file_uxbinary <== | |
|
596 | this is uxbinary | |
|
597 | $Id$ | |
|
598 | $Header$ | |
|
599 | $Date$ | |
|
600 | $DateTime$ | |
|
601 | $Change$ | |
|
602 | $File$ | |
|
603 | $Revision$ | |
|
604 | $Header$$Header$Header$ | |
|
605 | ||
|
606 | ==> dst/file_xbinary <== | |
|
607 | this is xbinary | |
|
608 | $Id$ | |
|
609 | $Header$ | |
|
610 | $Date$ | |
|
611 | $DateTime$ | |
|
612 | $Change$ | |
|
613 | $File$ | |
|
614 | $Revision$ | |
|
615 | $Header$$Header$Header$ | |
|
616 | ||
|
617 | ==> dst/file_xltext <== | |
|
618 | this is xltext | |
|
619 | $Id$ | |
|
620 | $Header$ | |
|
621 | $Date$ | |
|
622 | $DateTime$ | |
|
623 | $Change$ | |
|
624 | $File$ | |
|
625 | $Revision$ | |
|
626 | $Header$$Header$Header$ | |
|
627 | ||
|
628 | ==> dst/file_xtext <== | |
|
629 | this is xtext | |
|
630 | $Id$ | |
|
631 | $Header$ | |
|
632 | $Date$ | |
|
633 | $DateTime$ | |
|
634 | $Change$ | |
|
635 | $File$ | |
|
636 | $Revision$ | |
|
637 | $Header$$Header$Header$ | |
|
638 | ||
|
639 | % crazy_symlink | |
|
640 | target_$Header: //depot/test-mercurial-import/crazy_symlink+k#1 $ | |
|
641 | target_$Header$ | |
|
642 | % stop the p4 server |
@@ -12,6 +12,7 b' from mercurial.i18n import _' | |||
|
12 | 12 | |
|
13 | 13 | from common import commit, converter_source, checktool, NoRepo |
|
14 | 14 | import marshal |
|
15 | import re | |
|
15 | 16 | |
|
16 | 17 | def loaditer(f): |
|
17 | 18 | "Yield the dictionary objects generated by p4" |
@@ -28,7 +29,7 b' class p4_source(converter_source):' | |||
|
28 | 29 | def __init__(self, ui, path, rev=None): |
|
29 | 30 | super(p4_source, self).__init__(ui, path, rev=rev) |
|
30 | 31 | |
|
31 | if not path.startswith('//'): | |
|
32 | if "/" in path and not path.startswith('//'): | |
|
32 | 33 | raise NoRepo('%s does not look like a P4 repo' % path) |
|
33 | 34 | |
|
34 | 35 | checktool('p4', abort=False) |
@@ -43,6 +44,9 b' class p4_source(converter_source):' | |||
|
43 | 44 | self.encoding = "latin_1" |
|
44 | 45 | self.depotname = {} # mapping from local name to depot name |
|
45 | 46 | self.modecache = {} |
|
47 | self.re_type = re.compile("([a-z]+)?(text|binary|symlink|apple|resource|unicode|utf\d+)(\+\w+)?$") | |
|
48 | self.re_keywords = re.compile(r"\$(Id|Header|Date|DateTime|Change|File|Revision|Author):[^$\n]*\$") | |
|
49 | self.re_keywords_old = re.compile("\$(Id|Header):[^$\n]*\$") | |
|
46 | 50 | |
|
47 | 51 | self._parse(ui, path) |
|
48 | 52 | |
@@ -146,22 +150,44 b' class p4_source(converter_source):' | |||
|
146 | 150 | stdout = util.popen(cmd) |
|
147 | 151 | |
|
148 | 152 | mode = None |
|
149 |
|
|
|
153 | contents = "" | |
|
154 | keywords = None | |
|
150 | 155 | |
|
151 | 156 | for d in loaditer(stdout): |
|
152 |
|
|
|
153 | if "+x" in d["type"]: | |
|
157 | code = d["code"] | |
|
158 | data = d.get("data") | |
|
159 | ||
|
160 | if code == "error": | |
|
161 | raise IOError(d["generic"], data) | |
|
162 | ||
|
163 | elif code == "stat": | |
|
164 | p4type = self.re_type.match(d["type"]) | |
|
165 | if p4type: | |
|
166 | mode = "" | |
|
167 | flags = (p4type.group(1) or "") + (p4type.group(3) or "") | |
|
168 | if "x" in flags: | |
|
154 | 169 | mode = "x" |
|
155 | else: | |
|
156 | mode = "" | |
|
157 | elif d["code"] == "text": | |
|
158 | data += d["data"] | |
|
170 | if p4type.group(2) == "symlink": | |
|
171 | mode = "l" | |
|
172 | if "ko" in flags: | |
|
173 | keywords = self.re_keywords_old | |
|
174 | elif "k" in flags: | |
|
175 | keywords = self.re_keywords | |
|
176 | ||
|
177 | elif code == "text" or code == "binary": | |
|
178 | contents += data | |
|
159 | 179 | |
|
160 | 180 | if mode is None: |
|
161 | raise IOError() | |
|
181 | raise IOError(0, "bad stat") | |
|
162 | 182 | |
|
163 | 183 | self.modecache[(name, rev)] = mode |
|
164 | return data | |
|
184 | ||
|
185 | if keywords: | |
|
186 | contents = keywords.sub("$\\1$", contents) | |
|
187 | if mode == "l" and contents.endswith("\n"): | |
|
188 | contents = contents[:-1] | |
|
189 | ||
|
190 | return contents | |
|
165 | 191 | |
|
166 | 192 | def getmode(self, name, rev): |
|
167 | 193 | return self.modecache[(name, rev)] |
General Comments 0
You need to be logged in to leave comments.
Login now