Mercurial > public > mercurial-scm > hg
comparison mercurial/scmutil.py @ 14669:2d2604adfdd6
context: add a match builder method
This is groundwork for matching against filesets in contexts
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 18 Jun 2011 16:52:51 -0500 |
parents | 5867bd6e7cf5 |
children | 19197fa4c41c |
comparison
equal
deleted
inserted
replaced
14668:2d6f1b2c6a82 | 14669:2d2604adfdd6 |
---|---|
561 def match(repo, pats=[], opts={}, globbed=False, default='relpath'): | 561 def match(repo, pats=[], opts={}, globbed=False, default='relpath'): |
562 if pats == ("",): | 562 if pats == ("",): |
563 pats = [] | 563 pats = [] |
564 if not globbed and default == 'relpath': | 564 if not globbed and default == 'relpath': |
565 pats = expandpats(pats or []) | 565 pats = expandpats(pats or []) |
566 m = matchmod.match(repo.root, repo.getcwd(), pats, | 566 m = repo[None].match(pats, opts.get('include'), opts.get('exclude'), |
567 opts.get('include'), opts.get('exclude'), default, | 567 default) |
568 auditor=repo.auditor) | |
569 def badfn(f, msg): | 568 def badfn(f, msg): |
570 repo.ui.warn("%s: %s\n" % (m.rel(f), msg)) | 569 repo.ui.warn("%s: %s\n" % (m.rel(f), msg)) |
571 m.bad = badfn | 570 m.bad = badfn |
572 return m | 571 return m |
573 | 572 |