Kiln » Kiln Extensions
Clone URL:  
test-convert.py
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
#!/usr/bin/env python # Test various tricky bfadd corner cases. import os import common hgt = common.BfilesTester() hgt.announce('setup') os.mkdir('repo1') os.chdir('repo1') hgt.hg(['init']) os.mkdir('dir') os.mkdir('dir/a') os.mkdir('dir/b') os.mkdir('dir/b/c') os.mkdir('z') hgt.writefile('foo.dat', 'stuffnthings') hgt.writefile('foo', 'stuffnthings') hgt.writefile('dir/big.dat', 'a'*(1024*1024*3)) hgt.writefile('dir/big', 'a'*(1024*1024*3)) hgt.writefile('dir/a/small.dat', 'small') hgt.writefile('dir/a/small', 'small') hgt.hg(['add'], stdout='''adding dir/a/small adding dir/a/small.dat adding dir/big adding dir/big.dat adding foo adding foo.dat ''') hgt.hg(['commit', '-m', 'initial commit']) hgt.writefile('dir/b/medium.dat', 'b'*(1024*1024)) hgt.writefile('dir/b/medium', 'b'*(1024*1024)) hgt.writefile('dir/b/c/foo.dat', 'foo') hgt.writefile('dir/b/c/foo', 'foo') hgt.writefile('z/bigbig.dat', 'c'*(1024*1024*5)) hgt.writefile('z/bigbig', 'c'*(1024*1024*5)) hgt.hg(['add'], stdout='''adding dir/b/c/foo adding dir/b/c/foo.dat adding dir/b/medium adding dir/b/medium.dat adding z/bigbig adding z/bigbig.dat ''') hgt.hg(['commit', '-m', 'add more files']) hgt.writefile('foo.dat', 'stuffnthings2') hgt.writefile('foo', 'stuffnthings2') hgt.writefile('z/bigbig.dat', 'd'*(1024*1024*5)) hgt.writefile('z/bigbig', 'd'*(1024*1024*5)) hgt.hg(['commit', '-m', 'edit some files']) hgt.hg(['mv', 'z', 'dir'], stdout='''moving z/bigbig to dir/z/bigbig moving z/bigbig.dat to dir/z/bigbig.dat ''') hgt.hg(['commit', '-m', 'move files']) hgt.hg(['rm', 'dir/b'], stdout='''removing dir/b/c/foo removing dir/b/c/foo.dat removing dir/b/medium removing dir/b/medium.dat ''') hgt.hg(['commit', '-m', 'remove some files']) hgt.hg(['log'], stdout='''changeset: 4:c6ddff0dd76c tag: tip user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: remove some files changeset: 3:9769c20e1daa user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: move files changeset: 2:a73f17a91216 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: edit some files changeset: 1:73960f5ccfe2 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: add more files changeset: 0:d82117283c29 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: initial commit ''') os.chdir('..') hgt.updaterc() hgt.hg(['kbfconvert', '-s', '100', 'repo1', 'repo2'], stdout='initializing destination repo2\n') os.chdir('repo2') hgt.hg(['log'], stdout='''changeset: 4:c6ddff0dd76c tag: tip user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: remove some files changeset: 3:9769c20e1daa user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: move files changeset: 2:a73f17a91216 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: edit some files changeset: 1:73960f5ccfe2 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: add more files changeset: 0:d82117283c29 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: initial commit ''') hgt.hg(['up'], stdout='8 files updated, 0 files merged, 0 files removed, 0 files unresolved\n') hgt.assertfalse(os.path.exists('.kbf'), "bfile standins shouldn't exist") os.chdir('..') common.checkrepos(hgt, 'repo1', 'repo2', [0, 1, 2, 3, 4]) hgt.updaterc({'kilnbfiles': [('size', '2'), ('patterns', 'glob:**.dat')]}) hgt.hg(['kbfconvert', 'repo1', 'repo3'], stdout='initializing destination repo3\n') os.chdir('repo3') hgt.assertfalse(os.path.exists('.kbf'), 'nothing should exist yet') hgt.hg(['log'], stdout='''changeset: 4:41232093a631 tag: tip user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: remove some files changeset: 3:188a0c00241d user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: move files changeset: 2:925bcdcffc5e user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: edit some files changeset: 1:01c6a9ec7e2a user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: add more files changeset: 0:629107d2b19c user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: initial commit ''') hgt.hg(['up'], stdout='''8 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed bfiles 6 big files updated, 0 removed ''') hgt.asserttrue(os.path.exists('.kbf'), 'bfile standins should exist') hgt.asserttrue(os.path.exists('.kbf/foo.dat'), 'standin should exist') hgt.asserttrue(os.path.exists('.kbf/dir/big.dat'), 'standin should exist') hgt.asserttrue(os.path.exists('.kbf/dir/big'), 'standin should exist') hgt.asserttrue(os.path.exists('.kbf/dir/a/small.dat'), 'standin should exist') hgt.asserttrue(os.path.exists('.kbf/dir/z/bigbig.dat'), 'standin should exist') hgt.asserttrue(os.path.exists('.kbf/dir/z/bigbig'), 'standin should exist') hgt.assertfalse(os.path.exists('.kbf/foo'), "standin shouldn't exist") hgt.assertfalse(os.path.exists('.kbf/dir/a/small'), "standin shouldn't exist") os.chdir('..') common.checkrepos(hgt, 'repo1', 'repo3', [0, 1, 2, 3, 4]) hgt.hg(['kbfconvert', 'repo1', 'repo4', 'glob:**'], stdout='initializing destination repo4\n') os.chdir('repo4') hgt.hg(['log'], stdout='''changeset: 4:953a55e2a0ec tag: tip user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: remove some files changeset: 3:0a3a55055f88 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: move files changeset: 2:8fab379a648e user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: edit some files changeset: 1:10660481ee75 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: add more files changeset: 0:3325a02c4986 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: initial commit ''') hgt.hg(['up'], stdout='''8 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed bfiles 8 big files updated, 0 removed ''') hgt.asserttrue(os.path.exists('.kbf'), 'bfile standins should exist') hgt.asserttrue(os.path.exists('.kbf'), 'bfile standins should exist') hgt.asserttrue(os.path.exists('.kbf/foo.dat'), 'standin should exist') hgt.asserttrue(os.path.exists('.kbf/dir/big.dat'), 'standin should exist') hgt.asserttrue(os.path.exists('.kbf/dir/big'), 'standin should exist') hgt.asserttrue(os.path.exists('.kbf/dir/a/small.dat'), 'standin should exist') hgt.asserttrue(os.path.exists('.kbf/dir/z/bigbig.dat'), 'standin should exist') hgt.asserttrue(os.path.exists('.kbf/dir/z/bigbig'), 'standin should exist') hgt.asserttrue(os.path.exists('.kbf/foo'), 'standin should exist') hgt.asserttrue(os.path.exists('.kbf/dir/a/small'), 'standin should exist') os.chdir('..') common.checkrepos(hgt, 'repo1', 'repo4', [0, 1, 2, 3, 4]) hgt.hg(['kbfconvert', 'repo2', 'repo5', '--tonormal'], stdout='initializing destination repo5\n') common.checkrepos(hgt, 'repo1', 'repo5', [0, 1, 2, 3, 4]) os.chdir('repo5') hgt.hg(['up'], stdout='0 files updated, 0 files merged, 0 files removed, 0 files unresolved\n') hgt.assertfalse(os.path.exists('.kbf'), 'there should not be any standins') os.chdir('..') hgt.hg(['kbfconvert', 'repo3', 'repo6', '--tonormal'], stdout='initializing destination repo6\n') common.checkrepos(hgt, 'repo1', 'repo6', [0, 1, 2, 3, 4]) os.chdir('repo6') hgt.hg(['up'], stdout='0 files updated, 0 files merged, 0 files removed, 0 files unresolved\n') hgt.assertfalse(os.path.exists('.kbf'), 'there should not be any standins') os.chdir('..') hgt.hg(['kbfconvert', 'repo4', 'repo7', '--tonormal'], stdout='initializing destination repo7\n') common.checkrepos(hgt, 'repo4', 'repo7', [0, 1, 2, 3, 4]) os.chdir('repo7') hgt.hg(['up'], stdout='0 files updated, 0 files merged, 0 files removed, 0 files unresolved\n') hgt.assertfalse(os.path.exists('.kbf'), 'there should not be any standins') os.chdir('..')