comparison tests/test-convert-git.t @ 23048:ee5f834077be stable

merge default into stable for 3.2 freeze
author Matt Mackall <mpm@selenic.com>
date Sat, 18 Oct 2014 18:04:31 -0500
parents c63a09b6b337
children f7c0556d22d7
comparison
equal deleted inserted replaced
22843:b6531d806de8 23048:ee5f834077be
1 1 #require git
2 $ "$TESTDIR/hghave" git || exit 80 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
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 36 Remove the directory, then try to replace it with a file (issue754)
37 (issue 754)
38 37
39 $ git rm -f d/b 38 $ git rm -f d/b
40 rm 'd/b' 39 rm 'd/b'
41 $ commit -m t2 40 $ commit -m t2
42 $ echo d > d 41 $ echo d > d
50 $ commit -a -m t4.2 49 $ commit -a -m t4.2
51 $ git checkout master >/dev/null 2>/dev/null 50 $ git checkout master >/dev/null 2>/dev/null
52 $ git pull --no-commit . other > /dev/null 2>/dev/null 51 $ git pull --no-commit . other > /dev/null 2>/dev/null
53 $ commit -m 'Merge branch other' 52 $ commit -m 'Merge branch other'
54 $ cd .. 53 $ cd ..
55 $ 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/6\r (no-eol) (esc)
60 scanning [=============> ] 2/6\r (no-eol) (esc)
61 scanning [=====================> ] 3/6\r (no-eol) (esc)
62 scanning [============================> ] 4/6\r (no-eol) (esc)
63 scanning [===================================> ] 5/6\r (no-eol) (esc)
64 scanning [===========================================>] 6/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)
56 assuming destination git-repo-hg 91 assuming destination git-repo-hg
57 initializing destination git-repo-hg repository 92 initializing destination git-repo-hg repository
58 scanning source... 93 scanning source...
59 sorting... 94 sorting...
60 converting... 95 converting...
204 239
205 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz 240 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
206 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo 241 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
207 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux 242 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
208 243
209 test binary conversion (issue 1359) 244 test importing git renames and copies
210 245
246 $ cd git-repo2
247 $ git mv foo foo-renamed
248 since bar is not touched in this commit, this copy will not be detected
249 $ cp bar bar-copied
250 $ cp baz baz-copied
251 $ cp baz baz-copied2
252 $ echo baz2 >> baz
253 $ git add bar-copied baz-copied baz-copied2
254 $ commit -a -m 'rename and copy'
255 $ cd ..
256
257 input validation
258 $ hg convert --config convert.git.similarity=foo --datesort git-repo2 fullrepo
259 abort: convert.git.similarity is not an integer ('foo')
260 [255]
261 $ hg convert --config convert.git.similarity=-1 --datesort git-repo2 fullrepo
262 abort: similarity must be between 0 and 100
263 [255]
264 $ hg convert --config convert.git.similarity=101 --datesort git-repo2 fullrepo
265 abort: similarity must be between 0 and 100
266 [255]
267
268 $ hg -q convert --config convert.git.similarity=100 --datesort git-repo2 fullrepo
269 $ hg -R fullrepo status -C --change master
270 M baz
271 A bar-copied
272 A baz-copied
273 baz
274 A baz-copied2
275 baz
276 A foo-renamed
277 foo
278 R foo
279
280 $ cd git-repo2
281 $ echo bar2 >> bar
282 $ commit -a -m 'change bar'
283 $ cp bar bar-copied2
284 $ git add bar-copied2
285 $ commit -a -m 'copy with no changes'
286 $ cd ..
287
288 $ hg -q convert --config convert.git.similarity=100 \
289 > --config convert.git.findcopiesharder=1 --datesort git-repo2 fullrepo
290 $ hg -R fullrepo status -C --change master
291 A bar-copied2
292 bar
293
294 test binary conversion (issue1359)
295
296 $ count=19
211 $ mkdir git-repo3 297 $ mkdir git-repo3
212 $ cd git-repo3 298 $ cd git-repo3
213 $ git init-db >/dev/null 2>/dev/null 299 $ git init-db >/dev/null 2>/dev/null
214 $ python -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)' 300 $ $PYTHON -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)'
215 $ git add b 301 $ git add b
216 $ commit -a -m addbinary 302 $ commit -a -m addbinary
217 $ cd .. 303 $ cd ..
218 304
219 convert binary file 305 convert binary file
226 0 addbinary 312 0 addbinary
227 updating bookmarks 313 updating bookmarks
228 $ cd git-repo3-hg 314 $ cd git-repo3-hg
229 $ hg up -C 315 $ hg up -C
230 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 316 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
231 $ python -c 'print len(file("b", "rb").read())' 317 $ $PYTHON -c 'print len(file("b", "rb").read())'
232 4096 318 4096
233 $ cd .. 319 $ cd ..
234 320
235 test author vs committer 321 test author vs committer
236 322
361 $ cat foo 447 $ cat foo
362 sub 448 sub
363 449
364 $ cd ../.. 450 $ cd ../..
365 451
452 make sure rename detection doesn't break removing and adding gitmodules
453
454 $ cd git-repo6
455 $ git mv .gitmodules .gitmodules-renamed
456 $ commit -a -m 'rename .gitmodules'
457 $ git mv .gitmodules-renamed .gitmodules
458 $ commit -a -m 'rename .gitmodules back'
459 $ cd ..
460
461 $ hg --config convert.git.similarity=100 convert -q git-repo6 git-repo6-hg
462 $ hg -R git-repo6-hg log -r 'tip^' -T "{desc|firstline}\n"
463 rename .gitmodules
464 $ hg -R git-repo6-hg status -C --change 'tip^'
465 A .gitmodules-renamed
466 R .hgsub
467 R .hgsubstate
468 $ hg -R git-repo6-hg log -r tip -T "{desc|firstline}\n"
469 rename .gitmodules back
470 $ hg -R git-repo6-hg status -C --change tip
471 A .hgsub
472 A .hgsubstate
473 R .gitmodules-renamed
474
366 convert the revision removing '.gitmodules' itself (and related 475 convert the revision removing '.gitmodules' itself (and related
367 submodules) 476 submodules)
368 477
369 $ cd git-repo6 478 $ cd git-repo6
370 $ git rm .gitmodules 479 $ git rm .gitmodules