diff mercurial/util.py @ 1081:8b7d63489db3

Change canonpath to not know about repo objects Code in util should not have any knowledge about repo objects
author mpm@selenic.com
date Fri, 26 Aug 2005 23:29:10 -0700
parents e254bcbfe636
children ce96e316278a
line wrap: on
line diff
--- a/mercurial/util.py	Sat Aug 27 08:22:10 2005 +0200
+++ b/mercurial/util.py	Fri Aug 26 23:29:10 2005 -0700
@@ -85,20 +85,20 @@
     b.reverse()
     return os.sep.join((['..'] * len(a)) + b)
 
-def canonpath(repo, cwd, myname):
-    rootsep = repo.root + os.sep
+def canonpath(root, cwd, myname):
+    rootsep = root + os.sep
     name = myname
     if not name.startswith(os.sep):
-        name = os.path.join(repo.root, cwd, name)
+        name = os.path.join(root, cwd, name)
     name = os.path.normpath(name)
     if name.startswith(rootsep):
         return pconvert(name[len(rootsep):])
-    elif name == repo.root:
+    elif name == root:
         return ''
     else:
-        raise Abort('%s not under repository root' % myname)
+        raise Abort('%s not under root' % myname)
 
-def matcher(repo, cwd, names, inc, exc, head=''):
+def matcher(canonroot, cwd, names, inc, exc, head=''):
     def patkind(name):
         for prefix in 're:', 'glob:', 'path:', 'relpath:':
             if name.startswith(prefix): return name.split(':', 1)
@@ -135,7 +135,7 @@
     roots = []
     for kind, name in map(patkind, names):
         if kind in ('glob', 'relpath'):
-            name = canonpath(repo, cwd, name)
+            name = canonpath(canonroot, cwd, name)
             if name == '':
                 kind, name = 'glob', '**'
         if kind in ('glob', 'path', 're'):