Debian Codegraph @

tests/test-convert-bzr.t

raw
1 #require bzr
2
3 $ . "$TESTDIR/bzr-definitions"
4
5 create and rename on the same file in the same step
6
7 $ mkdir test-createandrename
8 $ cd test-createandrename
9 $ brz init -q source
10
11 test empty repo conversion (issue3233)
12
13 $ hg convert source source-hg
14 initializing destination source-hg repository
15 scanning source...
16 sorting...
17 converting...
18
19 back to the rename stuff
20
21 $ cd source
22 $ echo a > a
23 $ echo c > c
24 $ echo e > e
25 $ brz add -q a c e
26 $ brz commit -q -m 'Initial add: a, c, e'
27 $ brz mv a b
28 a => b
29 $ brz mv c d
30 c => d
31 $ brz mv e f
32 e => f
33 $ echo a2 >> a
34 $ mkdir e
35 $ brz add -q a e
36 $ brz commit -q -m 'rename a into b, create a, rename c into d'
37 $ cd ..
38 $ hg convert source source-hg
39 scanning source...
40 sorting...
41 converting...
42 1 Initial add: a, c, e
43 0 rename a into b, create a, rename c into d
44 $ glog -R source-hg
45 o 1@source "rename a into b, create a, rename c into d" files+: [b d f], files-: [c e], files: [a]
46 |
47 o 0@source "Initial add: a, c, e" files+: [a c e], files-: [], files: []
48
49
50 manifest
51
52 $ hg manifest -R source-hg -r tip
53 a
54 b
55 d
56 f
57
58 test --rev option
59
60 $ hg convert -r 1 source source-1-hg
61 initializing destination source-1-hg repository
62 scanning source...
63 sorting...
64 converting...
65 0 Initial add: a, c, e
66 $ glog -R source-1-hg
67 o 0@source "Initial add: a, c, e" files+: [a c e], files-: [], files: []
68
69
70 test with filemap
71
72 $ cat > filemap <<EOF
73 > exclude a
74 > EOF
75 $ hg convert --filemap filemap source source-filemap-hg
76 initializing destination source-filemap-hg repository
77 scanning source...
78 sorting...
79 converting...
80 1 Initial add: a, c, e
81 0 rename a into b, create a, rename c into d
82 $ hg -R source-filemap-hg manifest -r tip
83 b
84 d
85 f
86
87 convert from lightweight checkout
88
89 $ brz checkout --lightweight source source-light
90 $ hg convert -s bzr source-light source-light-hg
91 initializing destination source-light-hg repository
92 warning: lightweight checkouts may cause conversion failures, try with a regular branch instead.
93 $TESTTMP/test-createandrename/source-light does not look like a Bazaar repository
94 abort: source-light: missing or unsupported repository
95 [255]
96
97 extract timestamps that look just like hg's {date|isodate}:
98 yyyy-mm-dd HH:MM zzzz (no seconds!)
99 compare timestamps
100
101 $ cd source
102 $ brz log | \
103 > sed '/timestamp/!d;s/.\{15\}\([0-9: -]\{16\}\):.. \(.[0-9]\{4\}\)/\1 \2/' \
104 > > ../bzr-timestamps
105 $ cd ..
106 $ hg -R source-hg log --template "{date|isodate}\n" > hg-timestamps
107 $ cmp bzr-timestamps hg-timestamps || diff -u bzr-timestamps hg-timestamps
108 $ cd ..
109
110 merge
111
112 $ mkdir test-merge
113 $ cd test-merge
114 $ cat > helper.py <<EOF
115 > import sys
116 > from breezy import workingtree
117 > import breezy.bzr.bzrdir
118 > wt = workingtree.WorkingTree.open('.')
119 >
120 > message, stamp = sys.argv[1:]
121 > wt.commit(message, timestamp=int(stamp))
122 > EOF
123 $ brz init -q source
124 $ cd source
125 $ echo content > a
126 $ echo content2 > b
127 $ brz add -q a b
128 $ brz commit -q -m 'Initial add'
129 $ cd ..
130 $ brz branch -q source source-improve
131 $ cd source
132 $ echo more >> a
133 $ "$PYTHON" ../helper.py 'Editing a' 100
134 $ cd ../source-improve
135 $ echo content3 >> b
136 $ "$PYTHON" ../helper.py 'Editing b' 200
137 $ cd ../source
138 $ brz merge -q ../source-improve
139 $ brz commit -q -m 'Merged improve branch'
140 $ cd ..
141 $ hg convert --datesort source source-hg
142 initializing destination source-hg repository
143 scanning source...
144 sorting...
145 converting...
146 3 Initial add
147 2 Editing a
148 1 Editing b
149 0 Merged improve branch
150 $ glog -R source-hg
151 o 3@source "Merged improve branch" files+: [], files-: [], files: []
152 |\
153 | o 2@source-improve "Editing b" files+: [], files-: [], files: [b]
154 | |
155 o | 1@source "Editing a" files+: [], files-: [], files: [a]
156 |/
157 o 0@source "Initial add" files+: [a b], files-: [], files: []
158
159 $ cd ..
160
161 #if symlink execbit
162
163 symlinks and executable files
164
165 $ mkdir test-symlinks
166 $ cd test-symlinks
167 $ brz init -q source
168 $ cd source
169 $ touch program
170 $ chmod +x program
171 $ ln -s program altname
172 $ mkdir d
173 $ echo a > d/a
174 $ ln -s a syma
175 $ brz add -q altname program syma d/a
176 $ brz commit -q -m 'Initial setup'
177 $ touch newprog
178 $ chmod +x newprog
179 $ rm altname
180 $ ln -s newprog altname
181 $ chmod -x program
182 $ brz add -q newprog
183 $ brz commit -q -m 'Symlink changed, x bits changed'
184 $ cd ..
185 $ hg convert source source-hg
186 initializing destination source-hg repository
187 scanning source...
188 sorting...
189 converting...
190 1 Initial setup
191 0 Symlink changed, x bits changed
192 $ manifest source-hg 0
193 % manifest of 0
194 644 @ altname
195 644 d/a
196 755 * program
197 644 @ syma
198 $ manifest source-hg tip
199 % manifest of tip
200 644 @ altname
201 644 d/a
202 755 * newprog
203 644 program
204 644 @ syma
205
206 test the symlinks can be recreated
207
208 $ cd source-hg
209 $ hg up
210 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
211 $ hg cat syma; echo
212 a
213 $ cd ../..
214
215 #endif
216
217 Multiple branches
218
219 $ brz init-repo -q --no-trees repo
220 $ brz init -q repo/trunk
221 $ brz co repo/trunk repo-trunk
222 $ cd repo-trunk
223 $ echo a > a
224 $ brz add -q a
225 $ sleep 1 # help with sorting
226 $ brz ci -qm adda
227 $ brz tag trunk-tag
228 Created tag trunk-tag.
229 $ brz switch -b branch
230 Tree is up to date at revision 1.
231 Switched to branch*repo/branch/ (glob)
232 $ echo b > b
233 $ brz add -q b
234 $ brz ci -qm addb
235 $ brz tag branch-tag
236 Created tag branch-tag.
237 $ brz switch --force ../repo/trunk
238 Updated to revision 1.
239 Switched to branch*/repo/trunk/ (glob)
240 $ echo a >> a
241 $ sleep 1 # help with sorting
242 $ brz ci -qm changea
243 $ cd ..
244 $ hg convert --datesort repo repo-bzr
245 initializing destination repo-bzr repository
246 scanning source...
247 sorting...
248 converting...
249 2 adda
250 1 addb
251 0 changea
252 updating tags
253 $ (cd repo-bzr; glog)
254 o 3@default "update tags" files+: [.hgtags], files-: [], files: []
255 |
256 o 2@default "changea" files+: [], files-: [], files: [a]
257 |
258 | o 1@branch "addb" files+: [b], files-: [], files: []
259 |/
260 o 0@default "adda" files+: [a], files-: [], files: []
261
262
263 Test tags (converted identifiers are not stable because bzr ones are
264 not and get incorporated in extra fields).
265
266 $ hg -R repo-bzr tags
267 tip 3:* (glob)
268 branch-tag 1:* (glob)
269 trunk-tag 0:* (glob)
270
271 Nested repositories (issue3254)
272
273 $ brz init-repo -q --no-trees repo/inner
274 $ brz init -q repo/inner/trunk
275 $ brz co repo/inner/trunk inner-trunk
276 $ cd inner-trunk
277 $ echo b > b
278 $ brz add -q b
279 $ brz ci -qm addb
280 $ cd ..
281 $ hg convert --datesort repo noinner-bzr
282 initializing destination noinner-bzr repository
283 scanning source...
284 sorting...
285 converting...
286 2 adda
287 1 addb
288 0 changea
289 updating tags