comparison mercurial/cmdutil.py @ 6584:29c77e5dfb3c

walk: remove rel and exact returns
author Matt Mackall <mpm@selenic.com>
date Mon, 12 May 2008 11:37:08 -0500
parents 5acbdd3941c4
children d3d1d39da2fa
comparison
equal deleted inserted replaced
6583:3951e04ea989 6584:29c77e5dfb3c
235 m.bad = badfn 235 m.bad = badfn
236 return m 236 return m
237 237
238 def walk(repo, match, node=None): 238 def walk(repo, match, node=None):
239 for src, fn in repo.walk(node, match): 239 for src, fn in repo.walk(node, match):
240 yield src, fn, match.rel(fn), match.exact(fn) 240 yield src, fn
241 241
242 def findrenames(repo, added=None, removed=None, threshold=0.5): 242 def findrenames(repo, added=None, removed=None, threshold=0.5):
243 '''find renamed files -- yields (before, after, score) tuples''' 243 '''find renamed files -- yields (before, after, score) tuples'''
244 if added is None or removed is None: 244 if added is None or removed is None:
245 added, removed = repo.status()[1:3] 245 added, removed = repo.status()[1:3]
273 if similarity is None: 273 if similarity is None:
274 similarity = float(opts.get('similarity') or 0) 274 similarity = float(opts.get('similarity') or 0)
275 add, remove = [], [] 275 add, remove = [], []
276 mapping = {} 276 mapping = {}
277 m = match(repo, pats, opts) 277 m = match(repo, pats, opts)
278 for src, abs, rel, exact in walk(repo, m): 278 for src, abs in walk(repo, m):
279 target = repo.wjoin(abs) 279 target = repo.wjoin(abs)
280 rel = m.rel(abs)
281 exact = m.exact(abs)
280 if src == 'f' and abs not in repo.dirstate: 282 if src == 'f' and abs not in repo.dirstate:
281 add.append(abs) 283 add.append(abs)
282 mapping[abs] = rel, exact 284 mapping[abs] = rel, m.exact(abs)
283 if repo.ui.verbose or not exact: 285 if repo.ui.verbose or not exact:
284 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) 286 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs))
285 if repo.dirstate[abs] != 'r' and (not util.lexists(target) 287 if repo.dirstate[abs] != 'r' and (not util.lexists(target)
286 or (os.path.isdir(target) and not os.path.islink(target))): 288 or (os.path.isdir(target) and not os.path.islink(target))):
287 remove.append(abs) 289 remove.append(abs)
313 dryrun = opts.get("dry_run") 315 dryrun = opts.get("dry_run")
314 316
315 def walkpat(pat): 317 def walkpat(pat):
316 srcs = [] 318 srcs = []
317 m = match(repo, [pat], opts, globbed=True) 319 m = match(repo, [pat], opts, globbed=True)
318 for tag, abs, rel, exact in walk(repo, m): 320 for tag, abs in walk(repo, m):
319 state = repo.dirstate[abs] 321 state = repo.dirstate[abs]
322 rel = m.rel(abs)
323 exact = m.exact(abs)
320 if state in '?r': 324 if state in '?r':
321 if exact and state == '?': 325 if exact and state == '?':
322 ui.warn(_('%s: not copying - file is not managed\n') % rel) 326 ui.warn(_('%s: not copying - file is not managed\n') % rel)
323 if exact and state == 'r': 327 if exact and state == 'r':
324 ui.warn(_('%s: not copying - file has been marked for' 328 ui.warn(_('%s: not copying - file has been marked for'