comparison tests/test-subrepo-git.t @ 21566:a01988cd9b61 stable

subrepo: make "_sanitize()" take absolute path to the root of subrepo Before this patch, "hg update" doesn't sanitize ".hg/hgrc" in non-hg subrepos correctly, if "hg update" is executed not at the root of the parent repository. "_sanitize()" takes relative path to subrepo from the root of the parent repository, and passes it to "os.walk()". In this case, "os.walk()" expects CWD to be equal to the root of the parent repository. So, "os.walk()" can't find specified path (or may scan unexpected path), if CWD isn't equal to the root of the parent repository. Non-hg subrepo under nested hg-subrepos may cause same problem, too: CWD may be equal to the root of the outer most repository, or so. This patch makes "_sanitize()" take absolute path to the root of subrepo to sanitize correctly in such cases. This patch doesn't normalize the path to hostile files as the one relative to CWD (or the root of the outer most repository), to fix the problem in the simple way suitable for "stable". Normalizing should be done in the future: maybe as a part of the migration to vfs.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Thu, 08 May 2014 19:03:00 +0900
parents 7f7f634d073d
children 5900bc09e684
comparison
equal deleted inserted replaced
21565:7f7f634d073d 21566:a01988cd9b61
590 8:3473d20bddcf 590 8:3473d20bddcf
591 $ grep ' s$' .hgsubstate 591 $ grep ' s$' .hgsubstate
592 c4069473b459cf27fd4d7c2f50c4346b4e936599 s 592 c4069473b459cf27fd4d7c2f50c4346b4e936599 s
593 $ cd .. 593 $ cd ..
594 594
595 $ hg -R tc pull -q
596 $ hg -R tc update -q -C 3473d20bddcf 2>&1 | sort
597 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob)
598 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob)
595 $ cd tc 599 $ cd tc
596 $ hg pull -q
597 $ hg update -q -C 3473d20bddcf 2>&1 | sort
598 warning: removing potentially hostile 'hgrc' in 's/.hg' (glob)
599 warning: removing potentially hostile 'hgrc' in 's/sub/.hg' (glob)
600 $ hg parents -q 600 $ hg parents -q
601 8:3473d20bddcf 601 8:3473d20bddcf
602 $ grep ' s$' .hgsubstate 602 $ grep ' s$' .hgsubstate
603 c4069473b459cf27fd4d7c2f50c4346b4e936599 s 603 c4069473b459cf27fd4d7c2f50c4346b4e936599 s
604 $ cat s/.hg/hgrc 604 $ cat s/.hg/hgrc
640 cat: s/.hg/hgrc: No such file or directory 640 cat: s/.hg/hgrc: No such file or directory
641 [1] 641 [1]
642 $ cat s/sub/.hg/hgrc 642 $ cat s/sub/.hg/hgrc
643 cat: s/sub/.hg/hgrc: No such file or directory 643 cat: s/sub/.hg/hgrc: No such file or directory
644 [1] 644 [1]
645 $ hg pull -q 645 $ cd ..
646 $ hg update -q -C ed23f7fe024e 2>&1 | sort 646 $ hg -R tc pull -q
647 warning: removing potentially hostile 'hgrc' in 's/.hg' (glob) 647 $ hg -R tc update -q -C ed23f7fe024e 2>&1 | sort
648 warning: removing potentially hostile 'hgrc' in 's/sub/.hg' (glob) 648 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob)
649 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob)
650 $ cd tc
649 $ hg parents -q 651 $ hg parents -q
650 9:ed23f7fe024e 652 9:ed23f7fe024e
651 $ grep ' s$' .hgsubstate 653 $ grep ' s$' .hgsubstate
652 f262643c1077219fbd3858d54e78ef050ef84fbf s 654 f262643c1077219fbd3858d54e78ef050ef84fbf s
653 $ cat s/.hg/hgrc 655 $ cat s/.hg/hgrc