comparison tests/test-convert-git.t @ 21868:3420346174b1 stable

convert: detect removal of ".gitmodules" at git source revisions correctly Before this patch, all operations applied on ".gitmodules" at git source revisions are treated as modification, even if they are actually removal of it. If removal of ".gitmodules" is treated as modification unexpectedly, "hg convert" is aborted by the exception raised in "retrievegitmodules()" for ".gitmodules" at the git source revision removing it, because that revision doesn't have any information of ".gitmodules". This patch detects removal of ".gitmodules" at git source revisions correctly. If ".gitmodules" is removed at the git source revision, this patch records "hex(nullid)" as the contents hash value for ".hgsub" and ".hgsubstate" at the destination revision. This patch makes "getfile()" raise IOError also for ".hgstatus" and ".hgsubstate" if the contents hash value is "hex(nullid)", and this tells removal of ".hgstatus" and ".hgsubstate" at the destination revision to "localrepository.commitctx()" correctly. For files other than ".hgstatus" and ".hgsubstate", checking the contents hash value in "getfile()" may be redundant, because "catfile()" for them also does so. But this patch chooses writing it only once at the beginning of "getfile()", to avoid writing same code twice both for ".hgsub" and ".hgsubstate" separately.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Mon, 14 Jul 2014 23:33:59 +0900
parents aa9385f983fa
children 7a9cbb315d84
comparison
equal deleted inserted replaced
21867:829f2dd99f5c 21868:3420346174b1
361 $ cat foo 361 $ cat foo
362 sub 362 sub
363 363
364 $ cd ../.. 364 $ cd ../..
365 365
366 convert the revision removing '.gitmodules' itself (and related
367 submodules)
368
369 $ cd git-repo6
370 $ git rm .gitmodules
371 rm '.gitmodules'
372 $ git rm --cached git-repo5
373 rm 'git-repo5'
374 $ commit -a -m 'remove .gitmodules and submodule git-repo5'
375 $ cd ..
376
377 $ hg convert -q git-repo6 git-repo6-hg
378 $ hg -R git-repo6-hg tip -T "{desc|firstline}\n"
379 remove .gitmodules and submodule git-repo5
380 $ hg -R git-repo6-hg tip -T "{file_dels}\n"
381 .hgsub .hgsubstate
382
366 damaged git repository tests: 383 damaged git repository tests:
367 In case the hard-coded hashes change, the following commands can be used to 384 In case the hard-coded hashes change, the following commands can be used to
368 list the hashes and their corresponding types in the repository: 385 list the hashes and their corresponding types in the repository:
369 cd git-repo4/.git/objects 386 cd git-repo4/.git/objects
370 find . -type f | cut -c 3- | sed 's_/__' | xargs -n 1 -t git cat-file -t 387 find . -type f | cut -c 3- | sed 's_/__' | xargs -n 1 -t git cat-file -t