comparison mercurial/scmutil.py @ 14671:35c2cc322ba8

scmutil: switch match users to supplying contexts The most appropriate context is not always clearly defined. The obvious cases: For working directory commands, we use None For commands (eg annotate) with single revs, we use that revision The less obvious cases: For commands (eg status, diff) with a pair of revs, we use the second revision For commands that take a range (like log), we use None
author Matt Mackall <mpm@selenic.com>
date Sat, 18 Jun 2011 16:52:51 -0500
parents 19197fa4c41c
children 785bbc8634f8
comparison
equal deleted inserted replaced
14670:19197fa4c41c 14671:35c2cc322ba8
571 ctx = ctxorrepo[None] 571 ctx = ctxorrepo[None]
572 572
573 m = ctx.match(pats, opts.get('include'), opts.get('exclude'), 573 m = ctx.match(pats, opts.get('include'), opts.get('exclude'),
574 default) 574 default)
575 def badfn(f, msg): 575 def badfn(f, msg):
576 repo.ui.warn("%s: %s\n" % (m.rel(f), msg)) 576 ctx._repo.ui.warn("%s: %s\n" % (m.rel(f), msg))
577 m.bad = badfn 577 m.bad = badfn
578 return m 578 return m
579 579
580 def matchall(repo): 580 def matchall(repo):
581 return matchmod.always(repo.root, repo.getcwd()) 581 return matchmod.always(repo.root, repo.getcwd())
589 if similarity is None: 589 if similarity is None:
590 similarity = float(opts.get('similarity') or 0) 590 similarity = float(opts.get('similarity') or 0)
591 # we'd use status here, except handling of symlinks and ignore is tricky 591 # we'd use status here, except handling of symlinks and ignore is tricky
592 added, unknown, deleted, removed = [], [], [], [] 592 added, unknown, deleted, removed = [], [], [], []
593 audit_path = pathauditor(repo.root) 593 audit_path = pathauditor(repo.root)
594 m = match(repo, pats, opts) 594 m = match(repo[None], pats, opts)
595 for abs in repo.walk(m): 595 for abs in repo.walk(m):
596 target = repo.wjoin(abs) 596 target = repo.wjoin(abs)
597 good = True 597 good = True
598 try: 598 try:
599 audit_path(abs) 599 audit_path(abs)