##// END OF EJS Templates
walk: remove remaining users of cmdutils.matchpats
Matt Mackall -
r6582:5acbdd39 default
parent child Browse files
Show More
@@ -121,9 +121,9 b' def dodiff(ui, repo, diffcmd, diffopts, '
121 121 - just invoke the diff for a single file in the working dir
122 122 '''
123 123 node1, node2 = cmdutil.revpair(repo, opts['rev'])
124 files, matchfn, anypats = cmdutil.matchpats(repo, pats, opts)
124 matcher = cmdutil.match(repo, pats, opts)
125 125 modified, added, removed, deleted, unknown = repo.status(
126 node1, node2, files, match=matchfn)[:5]
126 node1, node2, matcher.files(), match=matcher)[:5]
127 127 if not (modified or added or removed):
128 128 return 0
129 129
@@ -255,8 +255,8 b' def _status(ui, repo, kwt, *pats, **opts'
255 255 '''Bails out if [keyword] configuration is not active.
256 256 Returns status of working directory.'''
257 257 if kwt:
258 files, match, anypats = cmdutil.matchpats(repo, pats, opts)
259 return repo.status(files=files, match=match, list_clean=True)
258 matcher = cmdutil.match(repo, pats, opts)
259 return repo.status(files=matcher.files(), match=matcher, list_clean=True)
260 260 if ui.configitems('keyword'):
261 261 raise util.Abort(_('[keyword] patterns cannot match'))
262 262 raise util.Abort(_('no [keyword] patterns configured'))
@@ -320,9 +320,8 b' class queue:'
320 320
321 321 def printdiff(self, repo, node1, node2=None, files=None,
322 322 fp=None, changes=None, opts={}):
323 fns, matchfn, anypats = cmdutil.matchpats(repo, files, opts)
324
325 patch.diff(repo, node1, node2, fns, match=matchfn,
323 m = cmdutil.match(repo, files, opts)
324 patch.diff(repo, node1, node2, m.files(), match=m,
326 325 fp=fp, changes=changes, opts=self.diffopts())
327 326
328 327 def mergeone(self, repo, mergeq, head, patch, rev):
@@ -621,11 +620,11 b' class queue:'
621 620 if os.path.exists(self.join(patch)):
622 621 raise util.Abort(_('patch "%s" already exists') % patch)
623 622 if opts.get('include') or opts.get('exclude') or pats:
624 fns, match, anypats = cmdutil.matchpats(repo, pats, opts)
625 m, a, r, d = repo.status(files=fns, match=match)[:4]
623 match = cmdutil.match(repo, pats, opts)
624 m, a, r, d = repo.status(files=match.files(), match=match)[:4]
626 625 else:
627 626 m, a, r, d = self.check_localchanges(repo, force)
628 fns, match, anypats = cmdutil.matchpats(repo, m + a + r)
627 match = cmdutil.match(repo, m + a + r)
629 628 commitfiles = m + a + r
630 629 self.check_toppatch(repo)
631 630 wlock = repo.wlock()
@@ -1024,7 +1023,7 b' class queue:'
1024 1023
1025 1024 if opts.get('git'):
1026 1025 self.diffopts().git = True
1027 fns, matchfn, anypats = cmdutil.matchpats(repo, pats, opts)
1026 matchfn = cmdutil.match(repo, pats, opts)
1028 1027 tip = repo.changelog.tip()
1029 1028 if top == tip:
1030 1029 # if the top of our patch queue is also the tip, there is an
@@ -85,8 +85,8 b' def purge(ui, repo, *dirs, **opts):'
85 85 directories = []
86 86 files = []
87 87 missing = []
88 roots, match, anypats = cmdutil.matchpats(repo, dirs, opts)
89 for src, f, st in repo.dirstate.statwalk(roots, match,
88 match = cmdutil.match(repo, dirs, opts)
89 for src, f, st in repo.dirstate.statwalk(match.files(), match,
90 90 ignored=ignored, directories=True):
91 91 if src == 'd':
92 92 directories.append(f)
@@ -235,10 +235,6 b' def match(repo, pats=[], opts={}, globbe'
235 235 m.bad = badfn
236 236 return m
237 237
238 def matchpats(repo, pats=[], opts={}, globbed=False, default='relpath'):
239 m = match(repo, pats, opts, globbed, default)
240 return m.files(), m, m.anypats()
241
242 238 def walk(repo, match, node=None):
243 239 for src, fn in repo.walk(node, match):
244 240 yield src, fn, match.rel(fn), match.exact(fn)
@@ -1182,6 +1178,6 b' def commit(ui, repo, commitfunc, pats, o'
1182 1178 else:
1183 1179 files = []
1184 1180 try:
1185 return commitfunc(ui, repo, files, message, match, opts)
1181 return commitfunc(ui, repo, files, message, m, opts)
1186 1182 except ValueError, inst:
1187 1183 raise util.Abort(str(inst))
@@ -959,9 +959,8 b' def diff(ui, repo, *pats, **opts):'
959 959 """
960 960 node1, node2 = cmdutil.revpair(repo, opts['rev'])
961 961
962 fns, matchfn, anypats = cmdutil.matchpats(repo, pats, opts)
963
964 patch.diff(repo, node1, node2, fns, match=matchfn,
962 m = cmdutil.match(repo, pats, opts)
963 patch.diff(repo, node1, node2, m.files(), match=m,
965 964 opts=patch.diffopts(ui, opts))
966 965
967 966 def export(ui, repo, *changesets, **opts):
@@ -1958,10 +1957,10 b' def parents(ui, repo, file_=None, **opts'
1958 1957 ctx = repo.workingctx()
1959 1958
1960 1959 if file_:
1961 files, match, anypats = cmdutil.matchpats(repo, (file_,), opts)
1962 if anypats or len(files) != 1:
1960 m = cmdutil.match(repo, (file_,), opts)
1961 if m.anypats() or len(m.files()) != 1:
1963 1962 raise util.Abort(_('can only specify an explicit file name'))
1964 file_ = files[0]
1963 file_ = m.files()[0]
1965 1964 filenodes = []
1966 1965 for cp in ctx.parents():
1967 1966 if not cp:
@@ -2130,7 +2129,7 b' def rawcommit(ui, repo, *pats, **opts):'
2130 2129
2131 2130 message = cmdutil.logmessage(opts)
2132 2131
2133 files, match, anypats = cmdutil.matchpats(repo, pats, opts)
2132 files = cmdutil.match(repo, pats, opts).files()
2134 2133 if opts['files']:
2135 2134 files += open(opts['files']).read().splitlines()
2136 2135
@@ -2182,12 +2181,11 b' def remove(ui, repo, *pats, **opts):'
2182 2181 if not pats and not after:
2183 2182 raise util.Abort(_('no files specified'))
2184 2183
2185 files, matchfn, anypats = cmdutil.matchpats(repo, pats, opts)
2186 mardu = map(dict.fromkeys, repo.status(files=files, match=matchfn))[:5]
2184 m = cmdutil.match(repo, pats, opts)
2185 mardu = map(dict.fromkeys, repo.status(files=m.files(), match=m))[:5]
2187 2186 modified, added, removed, deleted, unknown = mardu
2188 2187
2189 2188 remove, forget = [], []
2190 m = cmdutil.match(repo, pats, opts)
2191 2189 for src, abs, rel, exact in cmdutil.walk(repo, m):
2192 2190
2193 2191 reason = None
@@ -2634,11 +2632,10 b' def status(ui, repo, *pats, **opts):'
2634 2632 all = opts['all']
2635 2633 node1, node2 = cmdutil.revpair(repo, opts.get('rev'))
2636 2634
2637 files, matchfn, anypats = cmdutil.matchpats(repo, pats, opts)
2635 matcher = cmdutil.match(repo, pats, opts)
2638 2636 cwd = (pats and repo.getcwd()) or ''
2639 2637 modified, added, removed, deleted, unknown, ignored, clean = [
2640 n for n in repo.status(node1=node1, node2=node2, files=files,
2641 match=matchfn,
2638 n for n in repo.status(node1, node2, matcher.files(), matcher,
2642 2639 list_ignored=opts['ignored']
2643 2640 or all and not ui.quiet,
2644 2641 list_clean=opts['clean'] or all,
General Comments 0
You need to be logged in to leave comments. Login now