##// 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 return args
30 return args
31
31
32 def matchpats(repo, cwd, pats=[], opts={}, head=''):
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 opts.get('exclude'), head)
34 opts.get('exclude'), head)
35
35
36 def makewalk(repo, pats, opts, head=''):
36 def makewalk(repo, pats, opts, head=''):
@@ -85,20 +85,20 b' def pathto(n1, n2):'
85 b.reverse()
85 b.reverse()
86 return os.sep.join((['..'] * len(a)) + b)
86 return os.sep.join((['..'] * len(a)) + b)
87
87
88 def canonpath(repo, cwd, myname):
88 def canonpath(root, cwd, myname):
89 rootsep = repo.root + os.sep
89 rootsep = root + os.sep
90 name = myname
90 name = myname
91 if not name.startswith(os.sep):
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 name = os.path.normpath(name)
93 name = os.path.normpath(name)
94 if name.startswith(rootsep):
94 if name.startswith(rootsep):
95 return pconvert(name[len(rootsep):])
95 return pconvert(name[len(rootsep):])
96 elif name == repo.root:
96 elif name == root:
97 return ''
97 return ''
98 else:
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 def patkind(name):
102 def patkind(name):
103 for prefix in 're:', 'glob:', 'path:', 'relpath:':
103 for prefix in 're:', 'glob:', 'path:', 'relpath:':
104 if name.startswith(prefix): return name.split(':', 1)
104 if name.startswith(prefix): return name.split(':', 1)
@@ -135,7 +135,7 b' def matcher(repo, cwd, names, inc, exc, '
135 roots = []
135 roots = []
136 for kind, name in map(patkind, names):
136 for kind, name in map(patkind, names):
137 if kind in ('glob', 'relpath'):
137 if kind in ('glob', 'relpath'):
138 name = canonpath(repo, cwd, name)
138 name = canonpath(canonroot, cwd, name)
139 if name == '':
139 if name == '':
140 kind, name = 'glob', '**'
140 kind, name = 'glob', '**'
141 if kind in ('glob', 'path', 're'):
141 if kind in ('glob', 'path', 're'):
General Comments 0
You need to be logged in to leave comments. Login now