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