##// END OF EJS Templates
path_auditor: cache names of audited directories...
Alexis S. L. Carvalho -
r5200:c7e8fe11 default
parent child Browse files
Show More
@@ -692,7 +692,8 b' class path_auditor(object):'
692 692 - inside a nested repository'''
693 693
694 694 def __init__(self, root):
695 self.audited = {}
695 self.audited = set()
696 self.auditeddir = set()
696 697 self.root = root
697 698
698 699 def __call__(self, path):
@@ -720,10 +721,19 b' class path_auditor(object):'
720 721 os.path.isdir(os.path.join(curpath, '.hg'))):
721 722 raise Abort(_('path %r is inside repo %r') %
722 723 (path, prefix))
723 self.audited[prefix] = True
724
725 prefixes = []
724 726 for c in strutil.rfindall(normpath, os.sep):
725 check(normpath[:c])
726 self.audited[path] = True
727 prefix = normpath[:c]
728 if prefix in self.auditeddir:
729 break
730 check(prefix)
731 prefixes.append(prefix)
732
733 self.audited.add(path)
734 # only add prefixes to the cache after checking everything: we don't
735 # want to add "foo/bar/baz" before checking if there's a "foo/.hg"
736 self.auditeddir.update(prefixes)
727 737
728 738 def _makelock_file(info, pathname):
729 739 ld = os.open(pathname, os.O_CREAT | os.O_WRONLY | os.O_EXCL)
@@ -13,6 +13,10 b" echo '# should fail'"
13 13 hg st b/x
14 14 hg add b/x
15 15
16 echo '# should fail'
17 hg add b b/x
18 hg st
19
16 20 echo '# should arguably print nothing'
17 21 hg st b
18 22
@@ -2,6 +2,8 b''
2 2 # should fail
3 3 abort: path 'b/x' is inside repo 'b'
4 4 abort: path 'b/x' is inside repo 'b'
5 # should fail
6 abort: path 'b/x' is inside repo 'b'
5 7 # should arguably print nothing
6 8 # should fail
7 9 abort: path 'b/a' is inside repo 'b'
General Comments 0
You need to be logged in to leave comments. Login now