changeset 12077:ff6f5310ad92

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.
author Martin Geisler <mg@lazybytes.net>
date Sun, 29 Aug 2010 23:56:19 +0200
parents 49463314c24f
children e03ca36ba9f3
files mercurial/util.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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)