##// END OF EJS Templates
test-convert-git.t: add a test of convert progress bars for git...
Augie Fackler -
r22412:dde99b82 default
parent child Browse files
Show More
@@ -1,407 +1,443
1 #require git
1 #require git
2
2
3 $ echo "[core]" >> $HOME/.gitconfig
3 $ echo "[core]" >> $HOME/.gitconfig
4 $ echo "autocrlf = false" >> $HOME/.gitconfig
4 $ echo "autocrlf = false" >> $HOME/.gitconfig
5 $ echo "[core]" >> $HOME/.gitconfig
5 $ echo "[core]" >> $HOME/.gitconfig
6 $ echo "autocrlf = false" >> $HOME/.gitconfig
6 $ echo "autocrlf = false" >> $HOME/.gitconfig
7 $ echo "[extensions]" >> $HGRCPATH
7 $ echo "[extensions]" >> $HGRCPATH
8 $ echo "convert=" >> $HGRCPATH
8 $ echo "convert=" >> $HGRCPATH
9 $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
9 $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
10 $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
10 $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
11 $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
11 $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
12 $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
12 $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
13 $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
13 $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
14 $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
14 $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
15 $ INVALIDID1=afd12345af
15 $ INVALIDID1=afd12345af
16 $ INVALIDID2=28173x36ddd1e67bf7098d541130558ef5534a86
16 $ INVALIDID2=28173x36ddd1e67bf7098d541130558ef5534a86
17 $ VALIDID1=39b3d83f9a69a9ba4ebb111461071a0af0027357
17 $ VALIDID1=39b3d83f9a69a9ba4ebb111461071a0af0027357
18 $ VALIDID2=8dd6476bd09d9c7776355dc454dafe38efaec5da
18 $ VALIDID2=8dd6476bd09d9c7776355dc454dafe38efaec5da
19 $ count=10
19 $ count=10
20 $ commit()
20 $ commit()
21 > {
21 > {
22 > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
22 > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
23 > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
23 > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
24 > git commit "$@" >/dev/null 2>/dev/null || echo "git commit error"
24 > git commit "$@" >/dev/null 2>/dev/null || echo "git commit error"
25 > count=`expr $count + 1`
25 > count=`expr $count + 1`
26 > }
26 > }
27 $ mkdir git-repo
27 $ mkdir git-repo
28 $ cd git-repo
28 $ cd git-repo
29 $ git init-db >/dev/null 2>/dev/null
29 $ git init-db >/dev/null 2>/dev/null
30 $ echo a > a
30 $ echo a > a
31 $ mkdir d
31 $ mkdir d
32 $ echo b > d/b
32 $ echo b > d/b
33 $ git add a d
33 $ git add a d
34 $ commit -a -m t1
34 $ commit -a -m t1
35
35
36 Remove the directory, then try to replace it with a file (issue754)
36 Remove the directory, then try to replace it with a file (issue754)
37
37
38 $ git rm -f d/b
38 $ git rm -f d/b
39 rm 'd/b'
39 rm 'd/b'
40 $ commit -m t2
40 $ commit -m t2
41 $ echo d > d
41 $ echo d > d
42 $ git add d
42 $ git add d
43 $ commit -m t3
43 $ commit -m t3
44 $ echo b >> a
44 $ echo b >> a
45 $ commit -a -m t4.1
45 $ commit -a -m t4.1
46 $ git checkout -b other HEAD~ >/dev/null 2>/dev/null
46 $ git checkout -b other HEAD~ >/dev/null 2>/dev/null
47 $ echo c > a
47 $ echo c > a
48 $ echo a >> a
48 $ echo a >> a
49 $ commit -a -m t4.2
49 $ commit -a -m t4.2
50 $ git checkout master >/dev/null 2>/dev/null
50 $ git checkout master >/dev/null 2>/dev/null
51 $ git pull --no-commit . other > /dev/null 2>/dev/null
51 $ git pull --no-commit . other > /dev/null 2>/dev/null
52 $ commit -m 'Merge branch other'
52 $ commit -m 'Merge branch other'
53 $ cd ..
53 $ cd ..
54 $ hg convert --datesort git-repo
54 $ hg convert --config extensions.progress= --config progress.assume-tty=1 \
55 > --config progress.delay=0 --config progress.changedelay=0 \
56 > --config progress.refresh=0 --config progress.width=60 \
57 > --datesort git-repo
58 \r (no-eol) (esc)
59 scanning [ <=> ] 1\r (no-eol) (esc)
60 scanning [ <=> ] 2\r (no-eol) (esc)
61 scanning [ <=> ] 3\r (no-eol) (esc)
62 scanning [ <=> ] 4\r (no-eol) (esc)
63 scanning [ <=> ] 5\r (no-eol) (esc)
64 scanning [ <=> ] 6\r (no-eol) (esc)
65 \r (no-eol) (esc)
66 \r (no-eol) (esc)
67 converting [ ] 0/6\r (no-eol) (esc)
68 getting files [==================> ] 1/2\r (no-eol) (esc)
69 getting files [======================================>] 2/2\r (no-eol) (esc)
70 \r (no-eol) (esc)
71 \r (no-eol) (esc)
72 converting [======> ] 1/6\r (no-eol) (esc)
73 getting files [======================================>] 1/1\r (no-eol) (esc)
74 \r (no-eol) (esc)
75 \r (no-eol) (esc)
76 converting [=============> ] 2/6\r (no-eol) (esc)
77 getting files [======================================>] 1/1\r (no-eol) (esc)
78 \r (no-eol) (esc)
79 \r (no-eol) (esc)
80 converting [====================> ] 3/6\r (no-eol) (esc)
81 getting files [======================================>] 1/1\r (no-eol) (esc)
82 \r (no-eol) (esc)
83 \r (no-eol) (esc)
84 converting [===========================> ] 4/6\r (no-eol) (esc)
85 getting files [======================================>] 1/1\r (no-eol) (esc)
86 \r (no-eol) (esc)
87 \r (no-eol) (esc)
88 converting [==================================> ] 5/6\r (no-eol) (esc)
89 getting files [======================================>] 1/1\r (no-eol) (esc)
90 \r (no-eol) (esc)
55 assuming destination git-repo-hg
91 assuming destination git-repo-hg
56 initializing destination git-repo-hg repository
92 initializing destination git-repo-hg repository
57 scanning source...
93 scanning source...
58 sorting...
94 sorting...
59 converting...
95 converting...
60 5 t1
96 5 t1
61 4 t2
97 4 t2
62 3 t3
98 3 t3
63 2 t4.1
99 2 t4.1
64 1 t4.2
100 1 t4.2
65 0 Merge branch other
101 0 Merge branch other
66 updating bookmarks
102 updating bookmarks
67 $ hg up -q -R git-repo-hg
103 $ hg up -q -R git-repo-hg
68 $ hg -R git-repo-hg tip -v
104 $ hg -R git-repo-hg tip -v
69 changeset: 5:c78094926be2
105 changeset: 5:c78094926be2
70 bookmark: master
106 bookmark: master
71 tag: tip
107 tag: tip
72 parent: 3:f5f5cb45432b
108 parent: 3:f5f5cb45432b
73 parent: 4:4e174f80c67c
109 parent: 4:4e174f80c67c
74 user: test <test@example.org>
110 user: test <test@example.org>
75 date: Mon Jan 01 00:00:15 2007 +0000
111 date: Mon Jan 01 00:00:15 2007 +0000
76 files: a
112 files: a
77 description:
113 description:
78 Merge branch other
114 Merge branch other
79
115
80
116
81 $ count=10
117 $ count=10
82 $ mkdir git-repo2
118 $ mkdir git-repo2
83 $ cd git-repo2
119 $ cd git-repo2
84 $ git init-db >/dev/null 2>/dev/null
120 $ git init-db >/dev/null 2>/dev/null
85 $ echo foo > foo
121 $ echo foo > foo
86 $ git add foo
122 $ git add foo
87 $ commit -a -m 'add foo'
123 $ commit -a -m 'add foo'
88 $ echo >> foo
124 $ echo >> foo
89 $ commit -a -m 'change foo'
125 $ commit -a -m 'change foo'
90 $ git checkout -b Bar HEAD~ >/dev/null 2>/dev/null
126 $ git checkout -b Bar HEAD~ >/dev/null 2>/dev/null
91 $ echo quux >> quux
127 $ echo quux >> quux
92 $ git add quux
128 $ git add quux
93 $ commit -a -m 'add quux'
129 $ commit -a -m 'add quux'
94 $ echo bar > bar
130 $ echo bar > bar
95 $ git add bar
131 $ git add bar
96 $ commit -a -m 'add bar'
132 $ commit -a -m 'add bar'
97 $ git checkout -b Baz HEAD~ >/dev/null 2>/dev/null
133 $ git checkout -b Baz HEAD~ >/dev/null 2>/dev/null
98 $ echo baz > baz
134 $ echo baz > baz
99 $ git add baz
135 $ git add baz
100 $ commit -a -m 'add baz'
136 $ commit -a -m 'add baz'
101 $ git checkout master >/dev/null 2>/dev/null
137 $ git checkout master >/dev/null 2>/dev/null
102 $ git pull --no-commit . Bar Baz > /dev/null 2>/dev/null
138 $ git pull --no-commit . Bar Baz > /dev/null 2>/dev/null
103 $ commit -m 'Octopus merge'
139 $ commit -m 'Octopus merge'
104 $ echo bar >> bar
140 $ echo bar >> bar
105 $ commit -a -m 'change bar'
141 $ commit -a -m 'change bar'
106 $ git checkout -b Foo HEAD~ >/dev/null 2>/dev/null
142 $ git checkout -b Foo HEAD~ >/dev/null 2>/dev/null
107 $ echo >> foo
143 $ echo >> foo
108 $ commit -a -m 'change foo'
144 $ commit -a -m 'change foo'
109 $ git checkout master >/dev/null 2>/dev/null
145 $ git checkout master >/dev/null 2>/dev/null
110 $ git pull --no-commit -s ours . Foo > /dev/null 2>/dev/null
146 $ git pull --no-commit -s ours . Foo > /dev/null 2>/dev/null
111 $ commit -m 'Discard change to foo'
147 $ commit -m 'Discard change to foo'
112 $ cd ..
148 $ cd ..
113 $ glog()
149 $ glog()
114 > {
150 > {
115 > hg log -G --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
151 > hg log -G --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
116 > }
152 > }
117 $ splitrepo()
153 $ splitrepo()
118 > {
154 > {
119 > msg="$1"
155 > msg="$1"
120 > files="$2"
156 > files="$2"
121 > opts=$3
157 > opts=$3
122 > echo "% $files: $msg"
158 > echo "% $files: $msg"
123 > prefix=`echo "$files" | sed -e 's/ /-/g'`
159 > prefix=`echo "$files" | sed -e 's/ /-/g'`
124 > fmap="$prefix.fmap"
160 > fmap="$prefix.fmap"
125 > repo="$prefix.repo"
161 > repo="$prefix.repo"
126 > for i in $files; do
162 > for i in $files; do
127 > echo "include $i" >> "$fmap"
163 > echo "include $i" >> "$fmap"
128 > done
164 > done
129 > hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo"
165 > hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo"
130 > hg up -q -R "$repo"
166 > hg up -q -R "$repo"
131 > glog -R "$repo"
167 > glog -R "$repo"
132 > hg -R "$repo" manifest --debug
168 > hg -R "$repo" manifest --debug
133 > }
169 > }
134
170
135 full conversion
171 full conversion
136
172
137 $ hg -q convert --datesort git-repo2 fullrepo
173 $ hg -q convert --datesort git-repo2 fullrepo
138 $ hg up -q -R fullrepo
174 $ hg up -q -R fullrepo
139 $ glog -R fullrepo
175 $ glog -R fullrepo
140 @ 9 "Discard change to foo" files: foo
176 @ 9 "Discard change to foo" files: foo
141 |\
177 |\
142 | o 8 "change foo" files: foo
178 | o 8 "change foo" files: foo
143 | |
179 | |
144 o | 7 "change bar" files: bar
180 o | 7 "change bar" files: bar
145 |/
181 |/
146 o 6 "(octopus merge fixup)" files:
182 o 6 "(octopus merge fixup)" files:
147 |\
183 |\
148 | o 5 "Octopus merge" files: baz
184 | o 5 "Octopus merge" files: baz
149 | |\
185 | |\
150 o | | 4 "add baz" files: baz
186 o | | 4 "add baz" files: baz
151 | | |
187 | | |
152 +---o 3 "add bar" files: bar
188 +---o 3 "add bar" files: bar
153 | |
189 | |
154 o | 2 "add quux" files: quux
190 o | 2 "add quux" files: quux
155 | |
191 | |
156 | o 1 "change foo" files: foo
192 | o 1 "change foo" files: foo
157 |/
193 |/
158 o 0 "add foo" files: foo
194 o 0 "add foo" files: foo
159
195
160 $ hg -R fullrepo manifest --debug
196 $ hg -R fullrepo manifest --debug
161 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar
197 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar
162 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
198 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
163 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
199 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
164 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
200 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
165 $ splitrepo 'octopus merge' 'foo bar baz'
201 $ splitrepo 'octopus merge' 'foo bar baz'
166 % foo bar baz: octopus merge
202 % foo bar baz: octopus merge
167 @ 8 "Discard change to foo" files: foo
203 @ 8 "Discard change to foo" files: foo
168 |\
204 |\
169 | o 7 "change foo" files: foo
205 | o 7 "change foo" files: foo
170 | |
206 | |
171 o | 6 "change bar" files: bar
207 o | 6 "change bar" files: bar
172 |/
208 |/
173 o 5 "(octopus merge fixup)" files:
209 o 5 "(octopus merge fixup)" files:
174 |\
210 |\
175 | o 4 "Octopus merge" files: baz
211 | o 4 "Octopus merge" files: baz
176 | |\
212 | |\
177 o | | 3 "add baz" files: baz
213 o | | 3 "add baz" files: baz
178 | | |
214 | | |
179 +---o 2 "add bar" files: bar
215 +---o 2 "add bar" files: bar
180 | |
216 | |
181 | o 1 "change foo" files: foo
217 | o 1 "change foo" files: foo
182 |/
218 |/
183 o 0 "add foo" files: foo
219 o 0 "add foo" files: foo
184
220
185 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar
221 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar
186 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
222 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
187 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
223 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
188 $ splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux'
224 $ splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux'
189 % foo baz quux: only some parents of an octopus merge; "discard" a head
225 % foo baz quux: only some parents of an octopus merge; "discard" a head
190 @ 6 "Discard change to foo" files: foo
226 @ 6 "Discard change to foo" files: foo
191 |
227 |
192 o 5 "change foo" files: foo
228 o 5 "change foo" files: foo
193 |
229 |
194 o 4 "Octopus merge" files:
230 o 4 "Octopus merge" files:
195 |\
231 |\
196 | o 3 "add baz" files: baz
232 | o 3 "add baz" files: baz
197 | |
233 | |
198 | o 2 "add quux" files: quux
234 | o 2 "add quux" files: quux
199 | |
235 | |
200 o | 1 "change foo" files: foo
236 o | 1 "change foo" files: foo
201 |/
237 |/
202 o 0 "add foo" files: foo
238 o 0 "add foo" files: foo
203
239
204 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
240 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
205 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
241 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
206 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
242 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
207
243
208 test binary conversion (issue1359)
244 test binary conversion (issue1359)
209
245
210 $ mkdir git-repo3
246 $ mkdir git-repo3
211 $ cd git-repo3
247 $ cd git-repo3
212 $ git init-db >/dev/null 2>/dev/null
248 $ git init-db >/dev/null 2>/dev/null
213 $ python -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)'
249 $ python -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)'
214 $ git add b
250 $ git add b
215 $ commit -a -m addbinary
251 $ commit -a -m addbinary
216 $ cd ..
252 $ cd ..
217
253
218 convert binary file
254 convert binary file
219
255
220 $ hg convert git-repo3 git-repo3-hg
256 $ hg convert git-repo3 git-repo3-hg
221 initializing destination git-repo3-hg repository
257 initializing destination git-repo3-hg repository
222 scanning source...
258 scanning source...
223 sorting...
259 sorting...
224 converting...
260 converting...
225 0 addbinary
261 0 addbinary
226 updating bookmarks
262 updating bookmarks
227 $ cd git-repo3-hg
263 $ cd git-repo3-hg
228 $ hg up -C
264 $ hg up -C
229 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
265 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
230 $ python -c 'print len(file("b", "rb").read())'
266 $ python -c 'print len(file("b", "rb").read())'
231 4096
267 4096
232 $ cd ..
268 $ cd ..
233
269
234 test author vs committer
270 test author vs committer
235
271
236 $ mkdir git-repo4
272 $ mkdir git-repo4
237 $ cd git-repo4
273 $ cd git-repo4
238 $ git init-db >/dev/null 2>/dev/null
274 $ git init-db >/dev/null 2>/dev/null
239 $ echo >> foo
275 $ echo >> foo
240 $ git add foo
276 $ git add foo
241 $ commit -a -m addfoo
277 $ commit -a -m addfoo
242 $ echo >> foo
278 $ echo >> foo
243 $ GIT_AUTHOR_NAME="nottest"
279 $ GIT_AUTHOR_NAME="nottest"
244 $ commit -a -m addfoo2
280 $ commit -a -m addfoo2
245 $ cd ..
281 $ cd ..
246
282
247 convert author committer
283 convert author committer
248
284
249 $ hg convert git-repo4 git-repo4-hg
285 $ hg convert git-repo4 git-repo4-hg
250 initializing destination git-repo4-hg repository
286 initializing destination git-repo4-hg repository
251 scanning source...
287 scanning source...
252 sorting...
288 sorting...
253 converting...
289 converting...
254 1 addfoo
290 1 addfoo
255 0 addfoo2
291 0 addfoo2
256 updating bookmarks
292 updating bookmarks
257 $ hg -R git-repo4-hg log -v
293 $ hg -R git-repo4-hg log -v
258 changeset: 1:d63e967f93da
294 changeset: 1:d63e967f93da
259 bookmark: master
295 bookmark: master
260 tag: tip
296 tag: tip
261 user: nottest <test@example.org>
297 user: nottest <test@example.org>
262 date: Mon Jan 01 00:00:21 2007 +0000
298 date: Mon Jan 01 00:00:21 2007 +0000
263 files: foo
299 files: foo
264 description:
300 description:
265 addfoo2
301 addfoo2
266
302
267 committer: test <test@example.org>
303 committer: test <test@example.org>
268
304
269
305
270 changeset: 0:0735477b0224
306 changeset: 0:0735477b0224
271 user: test <test@example.org>
307 user: test <test@example.org>
272 date: Mon Jan 01 00:00:20 2007 +0000
308 date: Mon Jan 01 00:00:20 2007 +0000
273 files: foo
309 files: foo
274 description:
310 description:
275 addfoo
311 addfoo
276
312
277
313
278
314
279 --sourceorder should fail
315 --sourceorder should fail
280
316
281 $ hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg
317 $ hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg
282 initializing destination git-repo4-sourcesort-hg repository
318 initializing destination git-repo4-sourcesort-hg repository
283 abort: --sourcesort is not supported by this data source
319 abort: --sourcesort is not supported by this data source
284 [255]
320 [255]
285
321
286 test sub modules
322 test sub modules
287
323
288 $ mkdir git-repo5
324 $ mkdir git-repo5
289 $ cd git-repo5
325 $ cd git-repo5
290 $ git init-db >/dev/null 2>/dev/null
326 $ git init-db >/dev/null 2>/dev/null
291 $ echo 'sub' >> foo
327 $ echo 'sub' >> foo
292 $ git add foo
328 $ git add foo
293 $ commit -a -m 'addfoo'
329 $ commit -a -m 'addfoo'
294 $ BASE=`pwd`
330 $ BASE=`pwd`
295 $ cd ..
331 $ cd ..
296 $ mkdir git-repo6
332 $ mkdir git-repo6
297 $ cd git-repo6
333 $ cd git-repo6
298 $ git init-db >/dev/null 2>/dev/null
334 $ git init-db >/dev/null 2>/dev/null
299 $ git submodule add ${BASE} >/dev/null 2>/dev/null
335 $ git submodule add ${BASE} >/dev/null 2>/dev/null
300 $ commit -a -m 'addsubmodule' >/dev/null 2>/dev/null
336 $ commit -a -m 'addsubmodule' >/dev/null 2>/dev/null
301 $ cd ..
337 $ cd ..
302
338
303 test invalid splicemap1
339 test invalid splicemap1
304
340
305 $ cat > splicemap <<EOF
341 $ cat > splicemap <<EOF
306 > $VALIDID1
342 > $VALIDID1
307 > EOF
343 > EOF
308 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap1-hg
344 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap1-hg
309 initializing destination git-repo2-splicemap1-hg repository
345 initializing destination git-repo2-splicemap1-hg repository
310 abort: syntax error in splicemap(1): child parent1[,parent2] expected
346 abort: syntax error in splicemap(1): child parent1[,parent2] expected
311 [255]
347 [255]
312
348
313 test invalid splicemap2
349 test invalid splicemap2
314
350
315 $ cat > splicemap <<EOF
351 $ cat > splicemap <<EOF
316 > $VALIDID1 $VALIDID2, $VALIDID2, $VALIDID2
352 > $VALIDID1 $VALIDID2, $VALIDID2, $VALIDID2
317 > EOF
353 > EOF
318 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap2-hg
354 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap2-hg
319 initializing destination git-repo2-splicemap2-hg repository
355 initializing destination git-repo2-splicemap2-hg repository
320 abort: syntax error in splicemap(1): child parent1[,parent2] expected
356 abort: syntax error in splicemap(1): child parent1[,parent2] expected
321 [255]
357 [255]
322
358
323 test invalid splicemap3
359 test invalid splicemap3
324
360
325 $ cat > splicemap <<EOF
361 $ cat > splicemap <<EOF
326 > $INVALIDID1 $INVALIDID2
362 > $INVALIDID1 $INVALIDID2
327 > EOF
363 > EOF
328 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap3-hg
364 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap3-hg
329 initializing destination git-repo2-splicemap3-hg repository
365 initializing destination git-repo2-splicemap3-hg repository
330 abort: splicemap entry afd12345af is not a valid revision identifier
366 abort: splicemap entry afd12345af is not a valid revision identifier
331 [255]
367 [255]
332
368
333 convert sub modules
369 convert sub modules
334 $ hg convert git-repo6 git-repo6-hg
370 $ hg convert git-repo6 git-repo6-hg
335 initializing destination git-repo6-hg repository
371 initializing destination git-repo6-hg repository
336 scanning source...
372 scanning source...
337 sorting...
373 sorting...
338 converting...
374 converting...
339 0 addsubmodule
375 0 addsubmodule
340 updating bookmarks
376 updating bookmarks
341 $ hg -R git-repo6-hg log -v
377 $ hg -R git-repo6-hg log -v
342 changeset: 0:* (glob)
378 changeset: 0:* (glob)
343 bookmark: master
379 bookmark: master
344 tag: tip
380 tag: tip
345 user: nottest <test@example.org>
381 user: nottest <test@example.org>
346 date: Mon Jan 01 00:00:23 2007 +0000
382 date: Mon Jan 01 00:00:23 2007 +0000
347 files: .hgsub .hgsubstate
383 files: .hgsub .hgsubstate
348 description:
384 description:
349 addsubmodule
385 addsubmodule
350
386
351 committer: test <test@example.org>
387 committer: test <test@example.org>
352
388
353
389
354
390
355 $ cd git-repo6-hg
391 $ cd git-repo6-hg
356 $ hg up >/dev/null 2>/dev/null
392 $ hg up >/dev/null 2>/dev/null
357 $ cat .hgsubstate
393 $ cat .hgsubstate
358 * git-repo5 (glob)
394 * git-repo5 (glob)
359 $ cd git-repo5
395 $ cd git-repo5
360 $ cat foo
396 $ cat foo
361 sub
397 sub
362
398
363 $ cd ../..
399 $ cd ../..
364
400
365 convert the revision removing '.gitmodules' itself (and related
401 convert the revision removing '.gitmodules' itself (and related
366 submodules)
402 submodules)
367
403
368 $ cd git-repo6
404 $ cd git-repo6
369 $ git rm .gitmodules
405 $ git rm .gitmodules
370 rm '.gitmodules'
406 rm '.gitmodules'
371 $ git rm --cached git-repo5
407 $ git rm --cached git-repo5
372 rm 'git-repo5'
408 rm 'git-repo5'
373 $ commit -a -m 'remove .gitmodules and submodule git-repo5'
409 $ commit -a -m 'remove .gitmodules and submodule git-repo5'
374 $ cd ..
410 $ cd ..
375
411
376 $ hg convert -q git-repo6 git-repo6-hg
412 $ hg convert -q git-repo6 git-repo6-hg
377 $ hg -R git-repo6-hg tip -T "{desc|firstline}\n"
413 $ hg -R git-repo6-hg tip -T "{desc|firstline}\n"
378 remove .gitmodules and submodule git-repo5
414 remove .gitmodules and submodule git-repo5
379 $ hg -R git-repo6-hg tip -T "{file_dels}\n"
415 $ hg -R git-repo6-hg tip -T "{file_dels}\n"
380 .hgsub .hgsubstate
416 .hgsub .hgsubstate
381
417
382 damaged git repository tests:
418 damaged git repository tests:
383 In case the hard-coded hashes change, the following commands can be used to
419 In case the hard-coded hashes change, the following commands can be used to
384 list the hashes and their corresponding types in the repository:
420 list the hashes and their corresponding types in the repository:
385 cd git-repo4/.git/objects
421 cd git-repo4/.git/objects
386 find . -type f | cut -c 3- | sed 's_/__' | xargs -n 1 -t git cat-file -t
422 find . -type f | cut -c 3- | sed 's_/__' | xargs -n 1 -t git cat-file -t
387 cd ../../..
423 cd ../../..
388
424
389 damage git repository by renaming a commit object
425 damage git repository by renaming a commit object
390 $ COMMIT_OBJ=1c/0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd
426 $ COMMIT_OBJ=1c/0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd
391 $ mv git-repo4/.git/objects/$COMMIT_OBJ git-repo4/.git/objects/$COMMIT_OBJ.tmp
427 $ mv git-repo4/.git/objects/$COMMIT_OBJ git-repo4/.git/objects/$COMMIT_OBJ.tmp
392 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
428 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
393 abort: cannot read tags from git-repo4/.git
429 abort: cannot read tags from git-repo4/.git
394 $ mv git-repo4/.git/objects/$COMMIT_OBJ.tmp git-repo4/.git/objects/$COMMIT_OBJ
430 $ mv git-repo4/.git/objects/$COMMIT_OBJ.tmp git-repo4/.git/objects/$COMMIT_OBJ
395 damage git repository by renaming a blob object
431 damage git repository by renaming a blob object
396
432
397 $ BLOB_OBJ=8b/137891791fe96927ad78e64b0aad7bded08bdc
433 $ BLOB_OBJ=8b/137891791fe96927ad78e64b0aad7bded08bdc
398 $ mv git-repo4/.git/objects/$BLOB_OBJ git-repo4/.git/objects/$BLOB_OBJ.tmp
434 $ mv git-repo4/.git/objects/$BLOB_OBJ git-repo4/.git/objects/$BLOB_OBJ.tmp
399 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
435 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
400 abort: cannot read 'blob' object at 8b137891791fe96927ad78e64b0aad7bded08bdc
436 abort: cannot read 'blob' object at 8b137891791fe96927ad78e64b0aad7bded08bdc
401 $ mv git-repo4/.git/objects/$BLOB_OBJ.tmp git-repo4/.git/objects/$BLOB_OBJ
437 $ mv git-repo4/.git/objects/$BLOB_OBJ.tmp git-repo4/.git/objects/$BLOB_OBJ
402 damage git repository by renaming a tree object
438 damage git repository by renaming a tree object
403
439
404 $ TREE_OBJ=72/49f083d2a63a41cc737764a86981eb5f3e4635
440 $ TREE_OBJ=72/49f083d2a63a41cc737764a86981eb5f3e4635
405 $ mv git-repo4/.git/objects/$TREE_OBJ git-repo4/.git/objects/$TREE_OBJ.tmp
441 $ mv git-repo4/.git/objects/$TREE_OBJ git-repo4/.git/objects/$TREE_OBJ.tmp
406 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
442 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
407 abort: cannot read changes in 1c0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd
443 abort: cannot read changes in 1c0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd
General Comments 0
You need to be logged in to leave comments. Login now