util: add optional path auditor argument to canonpath
The canonpath function will default to creating its own path auditor,
but in some cases it will be useful to use a specialized auditor,
e.g., one that wont abort if a path lies within a subrepository.
--- a/mercurial/util.py Sat Aug 28 12:31:07 2010 -0400
+++ b/mercurial/util.py Sun Aug 29 23:56:19 2010 +0200
@@ -292,7 +292,7 @@
b.reverse()
return os.sep.join((['..'] * len(a)) + b) or '.'
-def canonpath(root, cwd, myname):
+def canonpath(root, cwd, myname, audit_path=None):
"""return the canonical path of myname, given cwd and root"""
if endswithsep(root):
rootsep = root
@@ -302,7 +302,8 @@
if not os.path.isabs(name):
name = os.path.join(root, cwd, name)
name = os.path.normpath(name)
- audit_path = path_auditor(root)
+ if audit_path is None:
+ audit_path = path_auditor(root)
if name != rootsep and name.startswith(rootsep):
name = name[len(rootsep):]
audit_path(name)