changeset 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 253072f39205
children ce96e316278a
files mercurial/commands.py mercurial/util.py
diffstat 2 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sat Aug 27 08:22:10 2005 +0200
+++ b/mercurial/commands.py	Fri Aug 26 23:29:10 2005 -0700
@@ -30,7 +30,7 @@
     return args
 
 def matchpats(repo, cwd, pats=[], opts={}, head=''):
-    return util.matcher(repo, cwd, pats or ['.'], opts.get('include'),
+    return util.matcher(repo.root, cwd, pats or ['.'], opts.get('include'),
                         opts.get('exclude'), head)
 
 def makewalk(repo, pats, opts, head=''):
--- 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'):