# HG changeset patch # User Martin Geisler <mg@lazybytes.net> # Date 1283118979 -7200 # Sun Aug 29 23:56:19 2010 +0200 # Node ID ff6f5310ad92a04e19fd3ed072800431f55b511d # Parent 49463314c24f4be58a07f7ecc85c80f91815c3bc 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. diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -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)