Mercurial > hg
comparison tests/test-subrepo-svn.t @ 21564:2e91d4964ecd stable
subrepo: make "_sanitize()" work
"_sanitize()" was introduced by 224e96078708 on "stable" branch, but
it has done nothing for sanitizing since 224e96078708.
"_sanitize()" assumes "Visitor" design pattern:
"os.walk()" should invoke specified function ("v" in this case)
for each directory elements under specified path
but "os.walk()" assumes "Iterator" design pattern:
callers of it should drive loop to scan each directory elements
under specified path by themselves with the returned generator
object
Because of this mismatching, "_sanitize()" just discards the generator
object returned by "os.walk()" and does nothing for sanitizing.
This patch makes "_sanitize()" work.
This patch also changes the format of warning message to show each
unlinked files, for multiple appearances of "potentially hostile
.hg/hgrc".
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Thu, 08 May 2014 19:03:00 +0900 |
parents | 7731a2281cf0 |
children | a01988cd9b61 |
comparison
equal
deleted
inserted
replaced
21556:5e13507a3b4e | 21564:2e91d4964ecd |
---|---|
630 $ hg up | 630 $ hg up |
631 A *subdir/a (glob) | 631 A *subdir/a (glob) |
632 Checked out revision 15. | 632 Checked out revision 15. |
633 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | 633 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
634 $ cd .. | 634 $ cd .. |
635 | |
636 Test sanitizing ".hg/hgrc" in subrepo | |
637 | |
638 $ cd sub/t | |
639 $ hg update -q -C tip | |
640 $ cd s | |
641 $ mkdir .hg | |
642 $ echo '.hg/hgrc in svn repo' > .hg/hgrc | |
643 $ mkdir -p sub/.hg | |
644 $ echo 'sub/.hg/hgrc in svn repo' > sub/.hg/hgrc | |
645 $ svn add .hg sub | |
646 A .hg | |
647 A .hg/hgrc (glob) | |
648 A sub | |
649 A sub/.hg (glob) | |
650 A sub/.hg/hgrc (glob) | |
651 $ svn ci -m 'add .hg/hgrc to be sanitized at hg update' | |
652 Adding .hg | |
653 Adding .hg/hgrc (glob) | |
654 Adding sub | |
655 Adding sub/.hg (glob) | |
656 Adding sub/.hg/hgrc (glob) | |
657 Transmitting file data .. | |
658 Committed revision 16. | |
659 $ svn up -q | |
660 $ cd .. | |
661 $ hg commit -S -m 'commit with svn revision including .hg/hgrc' | |
662 $ grep ' s$' .hgsubstate | |
663 16 s | |
664 $ cd .. | |
665 | |
666 $ 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 | |
671 16 s | |
672 $ cat s/.hg/hgrc | |
673 cat: s/.hg/hgrc: No such file or directory | |
674 [1] | |
675 $ cat s/sub/.hg/hgrc | |
676 cat: s/sub/.hg/hgrc: No such file or directory | |
677 [1] | |
678 | |
679 $ cd ../.. |