comparison mercurial/cmdutil.py @ 6586:d3463007d368

walk: return a single value
author Matt Mackall <mpm@selenic.com>
date Mon, 12 May 2008 11:37:08 -0500
parents d3d1d39da2fa
children 371415a2b959
comparison
equal deleted inserted replaced
6585:d3d1d39da2fa 6586:d3463007d368
269 if similarity is None: 269 if similarity is None:
270 similarity = float(opts.get('similarity') or 0) 270 similarity = float(opts.get('similarity') or 0)
271 add, remove = [], [] 271 add, remove = [], []
272 mapping = {} 272 mapping = {}
273 m = match(repo, pats, opts) 273 m = match(repo, pats, opts)
274 for src, abs in repo.walk(m): 274 for abs in repo.walk(m):
275 target = repo.wjoin(abs) 275 target = repo.wjoin(abs)
276 rel = m.rel(abs) 276 rel = m.rel(abs)
277 exact = m.exact(abs) 277 exact = m.exact(abs)
278 if src == 'f' and abs not in repo.dirstate: 278 if abs not in repo.dirstate:
279 add.append(abs) 279 add.append(abs)
280 mapping[abs] = rel, m.exact(abs) 280 mapping[abs] = rel, m.exact(abs)
281 if repo.ui.verbose or not exact: 281 if repo.ui.verbose or not exact:
282 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) 282 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs))
283 if repo.dirstate[abs] != 'r' and (not util.lexists(target) 283 if repo.dirstate[abs] != 'r' and (not util.lexists(target)
311 dryrun = opts.get("dry_run") 311 dryrun = opts.get("dry_run")
312 312
313 def walkpat(pat): 313 def walkpat(pat):
314 srcs = [] 314 srcs = []
315 m = match(repo, [pat], opts, globbed=True) 315 m = match(repo, [pat], opts, globbed=True)
316 for tag, abs in repo.walk(m): 316 for abs in repo.walk(m):
317 state = repo.dirstate[abs] 317 state = repo.dirstate[abs]
318 rel = m.rel(abs) 318 rel = m.rel(abs)
319 exact = m.exact(abs) 319 exact = m.exact(abs)
320 if state in '?r': 320 if state in '?r':
321 if exact and state == '?': 321 if exact and state == '?':