Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 6585:d3d1d39da2fa
walk: remove cmdutil.walk
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 12 May 2008 11:37:08 -0500 |
parents | 29c77e5dfb3c |
children | d3463007d368 |
comparison
equal
deleted
inserted
replaced
6584:29c77e5dfb3c | 6585:d3d1d39da2fa |
---|---|
233 repo.ui.warn("%s: %s\n" % (m.rel(f), msg)) | 233 repo.ui.warn("%s: %s\n" % (m.rel(f), msg)) |
234 return False | 234 return False |
235 m.bad = badfn | 235 m.bad = badfn |
236 return m | 236 return m |
237 | 237 |
238 def walk(repo, match, node=None): | |
239 for src, fn in repo.walk(node, match): | |
240 yield src, fn | |
241 | |
242 def findrenames(repo, added=None, removed=None, threshold=0.5): | 238 def findrenames(repo, added=None, removed=None, threshold=0.5): |
243 '''find renamed files -- yields (before, after, score) tuples''' | 239 '''find renamed files -- yields (before, after, score) tuples''' |
244 if added is None or removed is None: | 240 if added is None or removed is None: |
245 added, removed = repo.status()[1:3] | 241 added, removed = repo.status()[1:3] |
246 ctx = repo.changectx() | 242 ctx = repo.changectx() |
273 if similarity is None: | 269 if similarity is None: |
274 similarity = float(opts.get('similarity') or 0) | 270 similarity = float(opts.get('similarity') or 0) |
275 add, remove = [], [] | 271 add, remove = [], [] |
276 mapping = {} | 272 mapping = {} |
277 m = match(repo, pats, opts) | 273 m = match(repo, pats, opts) |
278 for src, abs in walk(repo, m): | 274 for src, abs in repo.walk(m): |
279 target = repo.wjoin(abs) | 275 target = repo.wjoin(abs) |
280 rel = m.rel(abs) | 276 rel = m.rel(abs) |
281 exact = m.exact(abs) | 277 exact = m.exact(abs) |
282 if src == 'f' and abs not in repo.dirstate: | 278 if src == 'f' and abs not in repo.dirstate: |
283 add.append(abs) | 279 add.append(abs) |
315 dryrun = opts.get("dry_run") | 311 dryrun = opts.get("dry_run") |
316 | 312 |
317 def walkpat(pat): | 313 def walkpat(pat): |
318 srcs = [] | 314 srcs = [] |
319 m = match(repo, [pat], opts, globbed=True) | 315 m = match(repo, [pat], opts, globbed=True) |
320 for tag, abs in walk(repo, m): | 316 for tag, abs in repo.walk(m): |
321 state = repo.dirstate[abs] | 317 state = repo.dirstate[abs] |
322 rel = m.rel(abs) | 318 rel = m.rel(abs) |
323 exact = m.exact(abs) | 319 exact = m.exact(abs) |
324 if state in '?r': | 320 if state in '?r': |
325 if exact and state == '?': | 321 if exact and state == '?': |