##// END OF EJS Templates
tests: unify test-convert-bzr
Matt Mackall -
r12512:8d84166d default
parent child Browse files
Show More
@@ -1,127 +1,209
1 #!/bin/sh
1
2 $ . "$TESTDIR/bzr-definitions"
3
4 create and rename on the same file in the same step
2
5
3 . "$TESTDIR/bzr-definitions"
6 $ mkdir test-createandrename
7 $ cd test-createandrename
8 $ bzr init -q source
9 $ cd source
10 $ echo a > a
11 $ echo c > c
12 $ echo e > e
13 $ bzr add -q a c e
14 $ bzr commit -q -m 'Initial add: a, c, e'
15 $ bzr mv a b
16 a => b
17 $ bzr mv c d
18 c => d
19 $ bzr mv e f
20 e => f
21 $ echo a2 >> a
22 $ mkdir e
23 $ bzr add -q a e
24 $ bzr commit -q -m 'rename a into b, create a, rename c into d'
25 $ cd ..
26 $ hg convert source source-hg
27 initializing destination source-hg repository
28 scanning source...
29 sorting...
30 converting...
31 1 Initial add: a, c, e
32 0 rename a into b, create a, rename c into d
33 $ glog -R source-hg
34 o 1 "rename a into b, create a, rename c into d" files: a b c d e f
35 |
36 o 0 "Initial add: a, c, e" files: a c e
37
38
39 manifest
40
41 $ hg manifest -R source-hg -r tip
42 a
43 b
44 d
45 f
46
47 test --rev option
4
48
5 echo % create and rename on the same file in the same step
49 $ hg convert -r 1 source source-1-hg
6 mkdir test-createandrename
50 initializing destination source-1-hg repository
7 cd test-createandrename
51 scanning source...
8 bzr init -q source
52 sorting...
9 cd source
53 converting...
10 echo a > a
54 0 Initial add: a, c, e
11 echo c > c
55 $ glog -R source-1-hg
12 echo e > e
56 o 0 "Initial add: a, c, e" files: a c e
13 bzr add -q a c e
57
14 bzr commit -q -m 'Initial add: a, c, e'
58
15 bzr mv a b
59 test with filemap
16 bzr mv c d
17 bzr mv e f
18 echo a2 >> a
19 mkdir e
20 bzr add -q a e
21 bzr commit -q -m 'rename a into b, create a, rename c into d'
22 cd ..
23 hg convert source source-hg
24 glog -R source-hg
25 echo "% manifest"
26 hg manifest -R source-hg -r tip
27 echo "% test --rev option"
28 hg convert -r 1 source source-1-hg
29 glog -R source-1-hg
30 echo "% test with filemap"
31 cat > filemap <<EOF
32 exclude a
33 EOF
34 hg convert --filemap filemap source source-filemap-hg
35 hg -R source-filemap-hg manifest -r tip
36
60
37 echo '% convert from lightweight checkout'
61 $ cat > filemap <<EOF
38 bzr checkout --lightweight source source-light
62 > exclude a
39 hg convert source-light source-light-hg
63 > EOF
40 echo "% lightweight manifest"
64 $ hg convert --filemap filemap source source-filemap-hg
41 hg manifest -R source-light-hg -r tip
65 initializing destination source-filemap-hg repository
66 scanning source...
67 sorting...
68 converting...
69 1 Initial add: a, c, e
70 0 rename a into b, create a, rename c into d
71 $ hg -R source-filemap-hg manifest -r tip
72 b
73 d
74 f
75
76 convert from lightweight checkout
42
77
43 # extract timestamps that look just like hg's {date|isodate}:
78 $ bzr checkout --lightweight source source-light
44 # yyyy-mm-dd HH:MM zzzz (no seconds!)
79 $ hg convert source-light source-light-hg
45 echo "% compare timestamps"
80 initializing destination source-light-hg repository
46 cd source
81 warning: lightweight checkouts may cause conversion failures, try with a regular branch instead.
47 bzr log | \
82 scanning source...
48 sed '/timestamp/!d;s/.\{15\}\([0-9: -]\{16\}\):.. \(.[0-9]\{4\}\)/\1 \2/' \
83 sorting...
49 > ../bzr-timestamps
84 converting...
50 cd ..
85 1 Initial add: a, c, e
86 0 rename a into b, create a, rename c into d
51
87
52 hg -R source-hg log --template "{date|isodate}\n" > hg-timestamps
88 lightweight manifest
53 if diff -q bzr-timestamps hg-timestamps ; then
54 echo "good: hg timestamps match bzr timestamps"
55 else
56 echo "fail: bzr timestamps are:"
57 cat bzr-timestamps
58 echo "but hg timestamps are:"
59 cat hg-timestamps
60 fi
61
89
62 cd ..
90 $ hg manifest -R source-light-hg -r tip
91 a
92 b
93 d
94 f
95
96 extract timestamps that look just like hg's {date|isodate}:
97 yyyy-mm-dd HH:MM zzzz (no seconds!)
98 compare timestamps
63
99
64 echo % merge
100 $ cd source
65 mkdir test-merge
101 $ bzr log | \
66 cd test-merge
102 > sed '/timestamp/!d;s/.\{15\}\([0-9: -]\{16\}\):.. \(.[0-9]\{4\}\)/\1 \2/' \
103 > > ../bzr-timestamps
104 $ cd ..
105 $ hg -R source-hg log --template "{date|isodate}\n" > hg-timestamps
106 $ diff -u bzr-timestamps hg-timestamps
107 $ cd ..
67
108
68 cat > helper.py <<EOF
109 merge
69 import sys
70 from bzrlib import workingtree
71 wt = workingtree.WorkingTree.open('.')
72
73 message, stamp = sys.argv[1:]
74 wt.commit(message, timestamp=int(stamp))
75 EOF
76
110
77 bzr init -q source
111 $ mkdir test-merge
78 cd source
112 $ cd test-merge
79 echo content > a
113 $ cat > helper.py <<EOF
80 echo content2 > b
114 > import sys
81 bzr add -q a b
115 > from bzrlib import workingtree
82 bzr commit -q -m 'Initial add'
116 > wt = workingtree.WorkingTree.open('.')
83 cd ..
117 >
84 bzr branch -q source source-improve
118 > message, stamp = sys.argv[1:]
85 cd source
119 > wt.commit(message, timestamp=int(stamp))
86 echo more >> a
120 > EOF
87 python ../helper.py 'Editing a' 100
121 $ bzr init -q source
88 cd ../source-improve
122 $ cd source
89 echo content3 >> b
123 $ echo content > a
90 python ../helper.py 'Editing b' 200
124 $ echo content2 > b
91 cd ../source
125 $ bzr add -q a b
92 bzr merge -q ../source-improve
126 $ bzr commit -q -m 'Initial add'
93 bzr commit -q -m 'Merged improve branch'
127 $ cd ..
94 cd ..
128 $ bzr branch -q source source-improve
95 hg convert --datesort source source-hg
129 $ cd source
96 glog -R source-hg
130 $ echo more >> a
97 cd ..
131 $ python ../helper.py 'Editing a' 100
132 $ cd ../source-improve
133 $ echo content3 >> b
134 $ python ../helper.py 'Editing b' 200
135 $ cd ../source
136 $ bzr merge -q ../source-improve
137 $ bzr commit -q -m 'Merged improve branch'
138 $ cd ..
139 $ hg convert --datesort source source-hg
140 initializing destination source-hg repository
141 scanning source...
142 sorting...
143 converting...
144 3 Initial add
145 2 Editing a
146 1 Editing b
147 0 Merged improve branch
148 $ glog -R source-hg
149 o 3 "Merged improve branch" files:
150 |\
151 | o 2 "Editing b" files: b
152 | |
153 o | 1 "Editing a" files: a
154 |/
155 o 0 "Initial add" files: a b
156
157 $ cd ..
158
159 symlinks and executable files
98
160
99 echo % symlinks and executable files
161 $ mkdir test-symlinks
100 mkdir test-symlinks
162 $ cd test-symlinks
101 cd test-symlinks
163 $ bzr init -q source
102 bzr init -q source
164 $ cd source
103 cd source
165 $ touch program
104 touch program
166 $ chmod +x program
105 chmod +x program
167 $ ln -s program altname
106 ln -s program altname
168 $ mkdir d
107 mkdir d
169 $ echo a > d/a
108 echo a > d/a
170 $ ln -s a syma
109 ln -s a syma
171 $ bzr add -q altname program syma d/a
110 bzr add -q altname program syma d/a
172 $ bzr commit -q -m 'Initial setup'
111 bzr commit -q -m 'Initial setup'
173 $ touch newprog
112 touch newprog
174 $ chmod +x newprog
113 chmod +x newprog
175 $ rm altname
114 rm altname
176 $ ln -s newprog altname
115 ln -s newprog altname
177 $ chmod -x program
116 chmod -x program
178 $ bzr add -q newprog
117 bzr add -q newprog
179 $ bzr commit -q -m 'Symlink changed, x bits changed'
118 bzr commit -q -m 'Symlink changed, x bits changed'
180 $ cd ..
119 cd ..
181 $ hg convert source source-hg
120 hg convert source source-hg
182 initializing destination source-hg repository
121 manifest source-hg 0
183 scanning source...
122 manifest source-hg tip
184 sorting...
123 cd source-hg
185 converting...
124 echo % test the symlinks can be recreated
186 1 Initial setup
125 hg up
187 0 Symlink changed, x bits changed
126 hg cat syma
188 $ manifest source-hg 0
127 cd ../..
189 % manifest of 0
190 644 @ altname
191 644 d/a
192 755 * program
193 644 @ syma
194 $ manifest source-hg tip
195 % manifest of tip
196 644 @ altname
197 644 d/a
198 755 * newprog
199 644 program
200 644 @ syma
201 $ cd source-hg
202
203 test the symlinks can be recreated
204
205 $ hg up
206 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
207 $ hg cat syma; echo
208 a
209
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