comparison tests/test-subrepo-svn.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 2e91d4964ecd
children 5900bc09e684
comparison
equal deleted inserted replaced
21565:7f7f634d073d 21566:a01988cd9b61
661 $ hg commit -S -m 'commit with svn revision including .hg/hgrc' 661 $ hg commit -S -m 'commit with svn revision including .hg/hgrc'
662 $ grep ' s$' .hgsubstate 662 $ grep ' s$' .hgsubstate
663 16 s 663 16 s
664 $ cd .. 664 $ cd ..
665 665
666 $ hg -R tc pull -u -q 2>&1 | sort
667 warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/.hg' (glob)
668 warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/sub/.hg' (glob)
666 $ cd tc 669 $ cd tc
667 $ hg pull -u -q 2>&1 | sort
668 warning: removing potentially hostile 'hgrc' in 's/.hg' (glob)
669 warning: removing potentially hostile 'hgrc' in 's/sub/.hg' (glob)
670 $ grep ' s$' .hgsubstate 670 $ grep ' s$' .hgsubstate
671 16 s 671 16 s
672 $ cat s/.hg/hgrc 672 $ cat s/.hg/hgrc
673 cat: s/.hg/hgrc: No such file or directory 673 cat: s/.hg/hgrc: No such file or directory
674 [1] 674 [1]