##// END OF EJS Templates
tests: unify test-convert-mtn
Matt Mackall -
r12532:742bb15d default
parent child Browse files
Show More
@@ -1,146 +1,358 b''
1 #!/bin/sh
1
2 $ "$TESTDIR/hghave" mtn || exit 80
3
4 Monotone directory is called .monotone on *nix and monotone
5 on Windows. Having a variable here ease test patching.
6
7 $ mtndir=.monotone
8 $ echo "[extensions]" >> $HGRCPATH
9 $ echo "convert=" >> $HGRCPATH
10 $ echo 'graphlog =' >> $HGRCPATH
11 $ HOME=`pwd`/do_not_use_HOME_mtn; export HOME
12
13 Windows version of monotone home
14
15 $ APPDATA=$HOME; export APPDATA
2
16
3 "$TESTDIR/hghave" mtn || exit 80
17 tedious monotone keys configuration
18 The /dev/null redirection is necessary under Windows, or
19 it complains about home directory permissions
20
21 $ mtn --quiet genkey test@selenic.com 1>/dev/null 2>&1 <<EOF
22 > passphrase
23 > passphrase
24 > EOF
25 $ cat >> $HOME/$mtndir/monotonerc <<EOF
26 > function get_passphrase(keypair_id)
27 > return "passphrase"
28 > end
29 > EOF
30
31 create monotone repository
4
32
5 # Monotone directory is called .monotone on *nix and monotone
33 $ mtn db init --db=repo.mtn
6 # on Windows. Having a variable here ease test patching.
34 $ mtn --db=repo.mtn --branch=com.selenic.test setup workingdir
7 mtndir=.monotone
35 $ cd workingdir
8 echo "[extensions]" >> $HGRCPATH
36 $ echo a > a
9 echo "convert=" >> $HGRCPATH
37 $ mkdir dir
10 echo 'graphlog =' >> $HGRCPATH
38 $ echo b > dir/b
39 $ echo d > dir/d
40 $ python -c 'file("bin", "wb").write("a\\x00b")'
41 $ echo c > c
42 $ mtn add a dir/b dir/d c bin
43 mtn: adding a to workspace manifest
44 mtn: adding bin to workspace manifest
45 mtn: adding c to workspace manifest
46 mtn: adding dir to workspace manifest
47 mtn: adding dir/b to workspace manifest
48 mtn: adding dir/d to workspace manifest
49 $ mtn ci -m initialize
50 mtn: beginning commit on branch 'com.selenic.test'
51 mtn: committed revision 0f6e5e4f2e7d2a8ef312408f57618abf026afd90
11
52
12 HOME=`pwd`/do_not_use_HOME_mtn; export HOME
53 update monotone working directory
13 # Windows version of monotone home
54
14 APPDATA=$HOME; export APPDATA
55 $ mtn mv a dir/a
56 mtn: skipping dir, already accounted for in workspace
57 mtn: renaming a to dir/a in workspace manifest
58 $ echo a >> dir/a
59 $ echo b >> dir/b
60 $ mtn drop c
61 mtn: dropping c from workspace manifest
62 $ python -c 'file("bin", "wb").write("b\\x00c")'
63 $ mtn ci -m update1
64 mtn: beginning commit on branch 'com.selenic.test'
65 mtn: committed revision 51d0a982464573a2a2cf5ee2c9219c652aaebeff
66 $ cd ..
67
68 convert once
15
69
16 echo % tedious monotone keys configuration
70 $ hg convert -s mtn repo.mtn
17 # The /dev/null redirection is necessary under Windows, or
71 assuming destination repo.mtn-hg
18 # it complains about home directory permissions
72 initializing destination repo.mtn-hg repository
19 mtn --quiet genkey test@selenic.com 1>/dev/null 2>&1 <<EOF
73 scanning source...
20 passphrase
74 sorting...
21 passphrase
75 converting...
22 EOF
76 1 initialize
23 cat >> $HOME/$mtndir/monotonerc <<EOF
77 0 update1
24 function get_passphrase(keypair_id)
78 $ cd workingdir
25 return "passphrase"
79 $ echo e > e
26 end
80 $ mtn add e
27 EOF
81 mtn: adding e to workspace manifest
82 $ mtn drop dir/b
83 mtn: dropping dir/b from workspace manifest
84 $ mtn mv bin bin2
85 mtn: renaming bin to bin2 in workspace manifest
86 $ mtn ci -m 'update2 "with" quotes'
87 mtn: beginning commit on branch 'com.selenic.test'
88 mtn: committed revision ebe58335d85d8cb176b6d0a12be04f5314b998da
89
90 test directory move
91
92 $ mkdir -p dir1/subdir1
93 $ mkdir -p dir1/subdir2_other
94 $ echo file1 > dir1/subdir1/file1
95 $ echo file2 > dir1/subdir2_other/file1
96 $ mtn add dir1/subdir1/file1 dir1/subdir2_other/file1
97 mtn: adding dir1 to workspace manifest
98 mtn: adding dir1/subdir1 to workspace manifest
99 mtn: adding dir1/subdir1/file1 to workspace manifest
100 mtn: adding dir1/subdir2_other to workspace manifest
101 mtn: adding dir1/subdir2_other/file1 to workspace manifest
102 $ mtn ci -m createdir1
103 mtn: beginning commit on branch 'com.selenic.test'
104 mtn: committed revision a8d62bc04fee4d2936d28e98bbcc81686dd74306
105 $ mtn rename dir1/subdir1 dir1/subdir2
106 mtn: skipping dir1, already accounted for in workspace
107 mtn: renaming dir1/subdir1 to dir1/subdir2 in workspace manifest
108 $ mtn ci -m movedir1
109 mtn: beginning commit on branch 'com.selenic.test'
110 mtn: committed revision 2c3d241bbbfe538b1b51d910f5676407e3f4d3a6
111
112 test subdirectory move
28
113
29 echo % create monotone repository
114 $ mtn mv dir dir2
30 mtn db init --db=repo.mtn
115 mtn: renaming dir to dir2 in workspace manifest
31 mtn --db=repo.mtn --branch=com.selenic.test setup workingdir
116 $ echo newfile > dir2/newfile
32 cd workingdir
117 $ mtn drop dir2/d
33 echo a > a
118 mtn: dropping dir2/d from workspace manifest
34 mkdir dir
119 $ mtn add dir2/newfile
35 echo b > dir/b
120 mtn: adding dir2/newfile to workspace manifest
36 echo d > dir/d
121 $ mtn ci -m movedir
37 python -c 'file("bin", "wb").write("a\\x00b")'
122 mtn: beginning commit on branch 'com.selenic.test'
38 echo c > c
123 mtn: committed revision fdb5a02dae8bfce3a79b3393680af471016e1b4c
39 mtn add a dir/b dir/d c bin
124
40 mtn ci -m initialize
125 Test directory removal with empty directory
41 echo % update monotone working directory
42 mtn mv a dir/a
43 echo a >> dir/a
44 echo b >> dir/b
45 mtn drop c
46 python -c 'file("bin", "wb").write("b\\x00c")'
47 mtn ci -m update1
48 cd ..
49
126
50 echo % convert once
127 $ mkdir dir2/dir
51 hg convert -s mtn repo.mtn
128 $ mkdir dir2/dir/subdir
129 $ echo f > dir2/dir/subdir/f
130 $ mkdir dir2/dir/emptydir
131 $ mtn add --quiet -R dir2/dir
132 $ mtn ci -m emptydir
133 mtn: beginning commit on branch 'com.selenic.test'
134 mtn: committed revision 8bbf76d717001d24964e4604739fdcd0f539fc88
135 $ mtn drop -R dir2/dir
136 mtn: dropping dir2/dir/subdir/f from workspace manifest
137 mtn: dropping dir2/dir/subdir from workspace manifest
138 mtn: dropping dir2/dir/emptydir from workspace manifest
139 mtn: dropping dir2/dir from workspace manifest
140 $ mtn ci -m dropdirectory
141 mtn: beginning commit on branch 'com.selenic.test'
142 mtn: committed revision 2323d4bc324e6c82628dc04d47a9fd32ad24e322
143
144 test directory and file move
145
146 $ mkdir -p dir3/d1
147 $ echo a > dir3/a
148 $ mtn add dir3/a dir3/d1
149 mtn: adding dir3 to workspace manifest
150 mtn: adding dir3/a to workspace manifest
151 mtn: adding dir3/d1 to workspace manifest
152 $ mtn ci -m dirfilemove
153 mtn: beginning commit on branch 'com.selenic.test'
154 mtn: committed revision 47b192f720faa622f48c68d1eb075b26d405aa8b
155 $ mtn mv dir3/a dir3/d1/a
156 mtn: skipping dir3/d1, already accounted for in workspace
157 mtn: renaming dir3/a to dir3/d1/a in workspace manifest
158 $ mtn mv dir3/d1 dir3/d2
159 mtn: skipping dir3, already accounted for in workspace
160 mtn: renaming dir3/d1 to dir3/d2 in workspace manifest
161 $ mtn ci -m dirfilemove2
162 mtn: beginning commit on branch 'com.selenic.test'
163 mtn: committed revision 8b543a400d3ee7f6d4bb1835b9b9e3747c8cb632
164
165 test directory move into another directory move
52
166
53 cd workingdir
167 $ mkdir dir4
54 echo e > e
168 $ mkdir dir5
55 mtn add e
169 $ echo a > dir4/a
56 mtn drop dir/b
170 $ mtn add dir4/a dir5
57 mtn mv bin bin2
171 mtn: adding dir4 to workspace manifest
58 mtn ci -m 'update2 "with" quotes'
172 mtn: adding dir4/a to workspace manifest
59 echo '% test directory move'
173 mtn: adding dir5 to workspace manifest
60 mkdir -p dir1/subdir1
174 $ mtn ci -m dirdirmove
61 mkdir -p dir1/subdir2_other
175 mtn: beginning commit on branch 'com.selenic.test'
62 echo file1 > dir1/subdir1/file1
176 mtn: committed revision 466e0b2afc7a55aa2b4ab2f57cb240bb6cd66fc7
63 echo file2 > dir1/subdir2_other/file1
177 $ mtn mv dir5 dir6
64 mtn add dir1/subdir1/file1 dir1/subdir2_other/file1
178 mtn: renaming dir5 to dir6 in workspace manifest
65 mtn ci -m createdir1
179 $ mtn mv dir4 dir6/dir4
66 mtn rename dir1/subdir1 dir1/subdir2
180 mtn: skipping dir6, already accounted for in workspace
67 mtn ci -m movedir1
181 mtn: renaming dir4 to dir6/dir4 in workspace manifest
68 echo '% test subdirectory move'
182 $ mtn ci -m dirdirmove2
69 mtn mv dir dir2
183 mtn: beginning commit on branch 'com.selenic.test'
70 echo newfile > dir2/newfile
184 mtn: committed revision 3d1f77ebad0c23a5d14911be3b670f990991b749
71 mtn drop dir2/d
185
72 mtn add dir2/newfile
186 test diverging directory moves
73 mtn ci -m movedir
187
74 # Test directory removal with empty directory
188 $ mkdir -p dir7/dir9/dir8
75 mkdir dir2/dir
189 $ echo a > dir7/dir9/dir8/a
76 mkdir dir2/dir/subdir
190 $ echo b > dir7/dir9/b
77 echo f > dir2/dir/subdir/f
191 $ echo c > dir7/c
78 mkdir dir2/dir/emptydir
192 $ mtn add -R dir7
79 mtn add --quiet -R dir2/dir
193 mtn: adding dir7 to workspace manifest
80 mtn ci -m emptydir
194 mtn: adding dir7/c to workspace manifest
81 mtn drop -R dir2/dir
195 mtn: adding dir7/dir9 to workspace manifest
82 mtn ci -m dropdirectory
196 mtn: adding dir7/dir9/b to workspace manifest
83 echo '% test directory and file move'
197 mtn: adding dir7/dir9/dir8 to workspace manifest
84 mkdir -p dir3/d1
198 mtn: adding dir7/dir9/dir8/a to workspace manifest
85 echo a > dir3/a
199 $ mtn ci -m divergentdirmove
86 mtn add dir3/a dir3/d1
200 mtn: beginning commit on branch 'com.selenic.test'
87 mtn ci -m dirfilemove
201 mtn: committed revision 08a08511f18b428d840199b062de90d0396bc2ed
88 mtn mv dir3/a dir3/d1/a
202 $ mtn mv dir7 dir7-2
89 mtn mv dir3/d1 dir3/d2
203 mtn: renaming dir7 to dir7-2 in workspace manifest
90 mtn ci -m dirfilemove2
204 $ mtn mv dir7-2/dir9 dir9-2
91 echo '% test directory move into another directory move'
205 mtn: renaming dir7-2/dir9 to dir9-2 in workspace manifest
92 mkdir dir4
206 $ mtn mv dir9-2/dir8 dir8-2
93 mkdir dir5
207 mtn: renaming dir9-2/dir8 to dir8-2 in workspace manifest
94 echo a > dir4/a
208 $ mtn ci -m divergentdirmove2
95 mtn add dir4/a dir5
209 mtn: beginning commit on branch 'com.selenic.test'
96 mtn ci -m dirdirmove
210 mtn: committed revision 4a736634505795f17786fffdf2c9cbf5b11df6f6
97 mtn mv dir5 dir6
211 $ cd ..
98 mtn mv dir4 dir6/dir4
212
99 mtn ci -m dirdirmove2
213 convert incrementally
100 echo '% test diverging directory moves'
101 mkdir -p dir7/dir9/dir8
102 echo a > dir7/dir9/dir8/a
103 echo b > dir7/dir9/b
104 echo c > dir7/c
105 mtn add -R dir7
106 mtn ci -m divergentdirmove
107 mtn mv dir7 dir7-2
108 mtn mv dir7-2/dir9 dir9-2
109 mtn mv dir9-2/dir8 dir8-2
110 mtn ci -m divergentdirmove2
111 cd ..
112
214
113 echo % convert incrementally
215 $ hg convert -s mtn repo.mtn
114 hg convert -s mtn repo.mtn
216 assuming destination repo.mtn-hg
115
217 scanning source...
116 glog()
218 sorting...
117 {
219 converting...
118 hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
220 11 update2 "with" quotes
119 }
221 10 createdir1
222 9 movedir1
223 8 movedir
224 7 emptydir
225 6 dropdirectory
226 5 dirfilemove
227 4 dirfilemove2
228 3 dirdirmove
229 2 dirdirmove2
230 1 divergentdirmove
231 0 divergentdirmove2
232 $ glog()
233 > {
234 > hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
235 > }
236 $ cd repo.mtn-hg
237 $ hg up -C
238 11 files updated, 0 files merged, 0 files removed, 0 files unresolved
239 $ glog
240 @ 13 "divergentdirmove2" files: dir7-2/c dir7/c dir7/dir9/b dir7/dir9/dir8/a dir8-2/a dir9-2/b
241 |
242 o 12 "divergentdirmove" files: dir7/c dir7/dir9/b dir7/dir9/dir8/a
243 |
244 o 11 "dirdirmove2" files: dir4/a dir6/dir4/a
245 |
246 o 10 "dirdirmove" files: dir4/a
247 |
248 o 9 "dirfilemove2" files: dir3/a dir3/d2/a
249 |
250 o 8 "dirfilemove" files: dir3/a
251 |
252 o 7 "dropdirectory" files: dir2/dir/subdir/f
253 |
254 o 6 "emptydir" files: dir2/dir/subdir/f
255 |
256 o 5 "movedir" files: dir/a dir/d dir2/a dir2/newfile
257 |
258 o 4 "movedir1" files: dir1/subdir1/file1 dir1/subdir2/file1
259 |
260 o 3 "createdir1" files: dir1/subdir1/file1 dir1/subdir2_other/file1
261 |
262 o 2 "update2 "with" quotes" files: bin bin2 dir/b e
263 |
264 o 1 "update1" files: a bin c dir/a dir/b
265 |
266 o 0 "initialize" files: a bin c dir/b dir/d
267
120
268
121 cd repo.mtn-hg
269 manifest
122 hg up -C
270
123 glog
271 $ hg manifest
124 echo % manifest
272 bin2
125 hg manifest
273 dir1/subdir2/file1
126 echo % contents
274 dir1/subdir2_other/file1
127 cat dir2/a
275 dir2/a
128 test -d dir2/dir && echo 'removed dir2/dir is still there!'
276 dir2/newfile
277 dir3/d2/a
278 dir6/dir4/a
279 dir7-2/c
280 dir8-2/a
281 dir9-2/b
282 e
283
284 contents
129
285
130 echo % file move
286 $ cat dir2/a
131 hg log -v -C -r 1 | grep copies
287 a
132 echo % check directory move
288 a
133 hg manifest -r 4
289 $ test -d dir2/dir && echo 'removed dir2/dir is still there!'
134 test -d dir1/subdir2 || echo 'new dir1/subdir2 does not exist!'
290 [1]
135 test -d dir1/subdir1 && echo 'renamed dir1/subdir1 is still there!'
291
136 hg log -v -C -r 4 | grep copies
292 file move
137 echo % check file remove with directory move
293
138 hg manifest -r 5
294 $ hg log -v -C -r 1 | grep copies
139 echo % check file move with directory move
295 copies: dir/a (a)
140 hg manifest -r 9
296
141 echo % check file directory directory move
297 check directory move
142 hg manifest -r 11
298
143 echo % check divergent directory moves
299 $ hg manifest -r 4
144 hg manifest -r 13
300 bin2
145 exit 0
301 dir/a
302 dir/d
303 dir1/subdir2/file1
304 dir1/subdir2_other/file1
305 e
306 $ test -d dir1/subdir2 || echo 'new dir1/subdir2 does not exist!'
307 $ test -d dir1/subdir1 && echo 'renamed dir1/subdir1 is still there!'
308 [1]
309 $ hg log -v -C -r 4 | grep copies
310 copies: dir1/subdir2/file1 (dir1/subdir1/file1)
311
312 check file remove with directory move
313
314 $ hg manifest -r 5
315 bin2
316 dir1/subdir2/file1
317 dir1/subdir2_other/file1
318 dir2/a
319 dir2/newfile
320 e
146
321
322 check file move with directory move
323
324 $ hg manifest -r 9
325 bin2
326 dir1/subdir2/file1
327 dir1/subdir2_other/file1
328 dir2/a
329 dir2/newfile
330 dir3/d2/a
331 e
332
333 check file directory directory move
334
335 $ hg manifest -r 11
336 bin2
337 dir1/subdir2/file1
338 dir1/subdir2_other/file1
339 dir2/a
340 dir2/newfile
341 dir3/d2/a
342 dir6/dir4/a
343 e
344
345 check divergent directory moves
346
347 $ hg manifest -r 13
348 bin2
349 dir1/subdir2/file1
350 dir1/subdir2_other/file1
351 dir2/a
352 dir2/newfile
353 dir3/d2/a
354 dir6/dir4/a
355 dir7-2/c
356 dir8-2/a
357 dir9-2/b
358 e
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now