##// END OF EJS Templates
audit: reject paths with .hg (issue 1450)...
Matt Mackall -
r7553:71be8688 default
parent child Browse files
Show More
@@ -814,9 +814,15 b' class path_auditor(object):'
814 return
814 return
815 normpath = os.path.normcase(path)
815 normpath = os.path.normcase(path)
816 parts = splitpath(normpath)
816 parts = splitpath(normpath)
817 if (os.path.splitdrive(path)[0] or parts[0] in ('.hg', '')
817 if (os.path.splitdrive(path)[0] or parts[0] in ('.hg', '.hg.', '')
818 or os.pardir in parts):
818 or os.pardir in parts):
819 raise Abort(_("path contains illegal component: %s") % path)
819 raise Abort(_("path contains illegal component: %s") % path)
820 if '.hg' in path:
821 for p in '.hg', '.hg.':
822 if p in parts[1:-1]:
823 pos = parts.index(p)
824 base = os.path.join(*parts[:pos])
825 raise Abort(_('path %r is inside repo %r') % (path, base))
820 def check(prefix):
826 def check(prefix):
821 curpath = os.path.join(self.root, prefix)
827 curpath = os.path.join(self.root, prefix)
822 try:
828 try:
General Comments 0
You need to be logged in to leave comments. Login now