##// END OF EJS Templates
Change canonpath to not know about repo objects...
mpm@selenic.com -
r1081:8b7d6348 default
parent child Browse files
Show More
@@ -30,7 +30,7 b' def relpath(repo, args):'
30 30 return args
31 31
32 32 def matchpats(repo, cwd, pats=[], opts={}, head=''):
33 return util.matcher(repo, cwd, pats or ['.'], opts.get('include'),
33 return util.matcher(repo.root, cwd, pats or ['.'], opts.get('include'),
34 34 opts.get('exclude'), head)
35 35
36 36 def makewalk(repo, pats, opts, head=''):
@@ -85,20 +85,20 b' def pathto(n1, n2):'
85 85 b.reverse()
86 86 return os.sep.join((['..'] * len(a)) + b)
87 87
88 def canonpath(repo, cwd, myname):
89 rootsep = repo.root + os.sep
88 def canonpath(root, cwd, myname):
89 rootsep = root + os.sep
90 90 name = myname
91 91 if not name.startswith(os.sep):
92 name = os.path.join(repo.root, cwd, name)
92 name = os.path.join(root, cwd, name)
93 93 name = os.path.normpath(name)
94 94 if name.startswith(rootsep):
95 95 return pconvert(name[len(rootsep):])
96 elif name == repo.root:
96 elif name == root:
97 97 return ''
98 98 else:
99 raise Abort('%s not under repository root' % myname)
99 raise Abort('%s not under root' % myname)
100 100
101 def matcher(repo, cwd, names, inc, exc, head=''):
101 def matcher(canonroot, cwd, names, inc, exc, head=''):
102 102 def patkind(name):
103 103 for prefix in 're:', 'glob:', 'path:', 'relpath:':
104 104 if name.startswith(prefix): return name.split(':', 1)
@@ -135,7 +135,7 b' def matcher(repo, cwd, names, inc, exc, '
135 135 roots = []
136 136 for kind, name in map(patkind, names):
137 137 if kind in ('glob', 'relpath'):
138 name = canonpath(repo, cwd, name)
138 name = canonpath(canonroot, cwd, name)
139 139 if name == '':
140 140 kind, name = 'glob', '**'
141 141 if kind in ('glob', 'path', 're'):
General Comments 0
You need to be logged in to leave comments. Login now