##// END OF EJS Templates
scmutil: drop aliases in cmdutil for match functions
Matt Mackall -
r14322:a90131b8 default
parent child Browse files
Show More
@@ -1,7 +1,7 b''
1 # perf.py - performance test routines
1 # perf.py - performance test routines
2 '''helper extension to measure performance'''
2 '''helper extension to measure performance'''
3
3
4 from mercurial import cmdutil, match, commands
4 from mercurial import cmdutil, scmutil, match, commands
5 import time, os, sys
5 import time, os, sys
6
6
7 def timer(func, title=None):
7 def timer(func, title=None):
@@ -31,11 +31,11 b' def timer(func, title=None):'
31
31
32 def perfwalk(ui, repo, *pats):
32 def perfwalk(ui, repo, *pats):
33 try:
33 try:
34 m = cmdutil.match(repo, pats, {})
34 m = scmutil.match(repo, pats, {})
35 timer(lambda: len(list(repo.dirstate.walk(m, [], True, False))))
35 timer(lambda: len(list(repo.dirstate.walk(m, [], True, False))))
36 except:
36 except:
37 try:
37 try:
38 m = cmdutil.match(repo, pats, {})
38 m = scmutil.match(repo, pats, {})
39 timer(lambda: len([b for a, b, c in repo.dirstate.statwalk([], m)]))
39 timer(lambda: len([b for a, b, c in repo.dirstate.statwalk([], m)]))
40 except:
40 except:
41 timer(lambda: len(list(cmdutil.walk(repo, pats, {}))))
41 timer(lambda: len(list(cmdutil.walk(repo, pats, {}))))
@@ -9,7 +9,7 b''
9 '''command to display statistics about repository history'''
9 '''command to display statistics about repository history'''
10
10
11 from mercurial.i18n import _
11 from mercurial.i18n import _
12 from mercurial import patch, cmdutil, util, templater, commands
12 from mercurial import patch, cmdutil, scmutil, util, templater, commands
13 import os
13 import os
14 import time, datetime
14 import time, datetime
15
15
@@ -24,7 +24,7 b' def maketemplater(ui, repo, tmpl):'
24
24
25 def changedlines(ui, repo, ctx1, ctx2, fns):
25 def changedlines(ui, repo, ctx1, ctx2, fns):
26 added, removed = 0, 0
26 added, removed = 0, 0
27 fmatch = cmdutil.matchfiles(repo, fns)
27 fmatch = scmutil.matchfiles(repo, fns)
28 diff = ''.join(patch.diff(repo, ctx1.node(), ctx2.node(), fmatch))
28 diff = ''.join(patch.diff(repo, ctx1.node(), ctx2.node(), fmatch))
29 for l in diff.split('\n'):
29 for l in diff.split('\n'):
30 if l.startswith("+") and not l.startswith("+++ "):
30 if l.startswith("+") and not l.startswith("+++ "):
@@ -54,7 +54,7 b' def countrate(ui, repo, amap, *pats, **o'
54 if opts.get('date'):
54 if opts.get('date'):
55 df = util.matchdate(opts['date'])
55 df = util.matchdate(opts['date'])
56
56
57 m = cmdutil.match(repo, pats, opts)
57 m = scmutil.match(repo, pats, opts)
58 def prep(ctx, fns):
58 def prep(ctx, fns):
59 rev = ctx.rev()
59 rev = ctx.rev()
60 if df and not df(ctx.date()[0]): # doesn't match date format
60 if df and not df(ctx.date()[0]): # doesn't match date format
@@ -62,7 +62,7 b' pretty fast (at least faster than having'
62
62
63 from mercurial.i18n import _
63 from mercurial.i18n import _
64 from mercurial.node import short, nullid
64 from mercurial.node import short, nullid
65 from mercurial import cmdutil, scmutil, util, commands, encoding
65 from mercurial import scmutil, scmutil, util, commands, encoding
66 import os, shlex, shutil, tempfile, re
66 import os, shlex, shutil, tempfile, re
67
67
68 def snapshot(ui, repo, files, node, tmproot):
68 def snapshot(ui, repo, files, node, tmproot):
@@ -137,7 +137,7 b' def dodiff(ui, repo, diffcmd, diffopts, '
137 if node1b == nullid:
137 if node1b == nullid:
138 do3way = False
138 do3way = False
139
139
140 matcher = cmdutil.match(repo, pats, opts)
140 matcher = scmutil.match(repo, pats, opts)
141 mod_a, add_a, rem_a = map(set, repo.status(node1a, node2, matcher)[:3])
141 mod_a, add_a, rem_a = map(set, repo.status(node1a, node2, matcher)[:3])
142 if do3way:
142 if do3way:
143 mod_b, add_b, rem_b = map(set, repo.status(node1b, node2, matcher)[:3])
143 mod_b, add_b, rem_b = map(set, repo.status(node1b, node2, matcher)[:3])
@@ -35,7 +35,7 b' vdiff on hovered and selected revisions.'
35 '''
35 '''
36
36
37 import os
37 import os
38 from mercurial import commands, util, patch, revlog, cmdutil
38 from mercurial import commands, util, patch, revlog, scmutil
39 from mercurial.node import nullid, nullrev, short
39 from mercurial.node import nullid, nullrev, short
40 from mercurial.i18n import _
40 from mercurial.i18n import _
41
41
@@ -45,7 +45,7 b' def difftree(ui, repo, node1=None, node2'
45 assert node2 is not None
45 assert node2 is not None
46 mmap = repo[node1].manifest()
46 mmap = repo[node1].manifest()
47 mmap2 = repo[node2].manifest()
47 mmap2 = repo[node2].manifest()
48 m = cmdutil.match(repo, files)
48 m = scmutil.match(repo, files)
49 modified, added, removed = repo.status(node1, node2, m)[:3]
49 modified, added, removed = repo.status(node1, node2, m)[:3]
50 empty = short(nullid)
50 empty = short(nullid)
51
51
@@ -81,7 +81,7 b' def difftree(ui, repo, node1=None, node2'
81 if opts['patch']:
81 if opts['patch']:
82 if opts['pretty']:
82 if opts['pretty']:
83 catcommit(ui, repo, node2, "")
83 catcommit(ui, repo, node2, "")
84 m = cmdutil.match(repo, files)
84 m = scmutil.match(repo, files)
85 chunks = patch.diff(repo, node1, node2, match=m,
85 chunks = patch.diff(repo, node1, node2, match=m,
86 opts=patch.diffopts(ui, {'git': True}))
86 opts=patch.diffopts(ui, {'git': True}))
87 for chunk in chunks:
87 for chunk in chunks:
@@ -326,7 +326,7 b' def _status(ui, repo, kwt, *pats, **opts'
326 '''Bails out if [keyword] configuration is not active.
326 '''Bails out if [keyword] configuration is not active.
327 Returns status of working directory.'''
327 Returns status of working directory.'''
328 if kwt:
328 if kwt:
329 return repo.status(match=cmdutil.match(repo, pats, opts), clean=True,
329 return repo.status(match=scmutil.match(repo, pats, opts), clean=True,
330 unknown=opts.get('unknown') or opts.get('all'))
330 unknown=opts.get('unknown') or opts.get('all'))
331 if ui.configitems('keyword'):
331 if ui.configitems('keyword'):
332 raise util.Abort(_('[keyword] patterns cannot match'))
332 raise util.Abort(_('[keyword] patterns cannot match'))
@@ -46,7 +46,7 b' from mercurial.i18n import _'
46 from mercurial.node import bin, hex, short, nullid, nullrev
46 from mercurial.node import bin, hex, short, nullid, nullrev
47 from mercurial.lock import release
47 from mercurial.lock import release
48 from mercurial import commands, cmdutil, hg, scmutil, util, revset
48 from mercurial import commands, cmdutil, hg, scmutil, util, revset
49 from mercurial import repair, extensions, url, error, scmutil
49 from mercurial import repair, extensions, url, error
50 from mercurial import patch as patchmod
50 from mercurial import patch as patchmod
51 import os, sys, re, errno, shutil
51 import os, sys, re, errno, shutil
52
52
@@ -519,7 +519,7 b' class queue(object):'
519 def printdiff(self, repo, diffopts, node1, node2=None, files=None,
519 def printdiff(self, repo, diffopts, node1, node2=None, files=None,
520 fp=None, changes=None, opts={}):
520 fp=None, changes=None, opts={}):
521 stat = opts.get('stat')
521 stat = opts.get('stat')
522 m = cmdutil.match(repo, files, opts)
522 m = scmutil.match(repo, files, opts)
523 cmdutil.diffordiffstat(self.ui, repo, diffopts, node1, node2, m,
523 cmdutil.diffordiffstat(self.ui, repo, diffopts, node1, node2, m,
524 changes, stat, fp)
524 changes, stat, fp)
525
525
@@ -711,7 +711,7 b' class queue(object):'
711 p1, p2 = repo.dirstate.parents()
711 p1, p2 = repo.dirstate.parents()
712 repo.dirstate.setparents(p1, merge)
712 repo.dirstate.setparents(p1, merge)
713
713
714 match = cmdutil.matchfiles(repo, files or [])
714 match = scmutil.matchfiles(repo, files or [])
715 n = repo.commit(message, ph.user, ph.date, match=match, force=True)
715 n = repo.commit(message, ph.user, ph.date, match=match, force=True)
716
716
717 if n is None:
717 if n is None:
@@ -898,7 +898,7 b' class queue(object):'
898 if opts.get('include') or opts.get('exclude') or pats:
898 if opts.get('include') or opts.get('exclude') or pats:
899 if inclsubs:
899 if inclsubs:
900 pats = list(pats or []) + inclsubs
900 pats = list(pats or []) + inclsubs
901 match = cmdutil.match(repo, pats, opts)
901 match = scmutil.match(repo, pats, opts)
902 # detect missing files in pats
902 # detect missing files in pats
903 def badfn(f, msg):
903 def badfn(f, msg):
904 if f != '.hgsubstate': # .hgsubstate is auto-created
904 if f != '.hgsubstate': # .hgsubstate is auto-created
@@ -907,7 +907,7 b' class queue(object):'
907 m, a, r, d = repo.status(match=match)[:4]
907 m, a, r, d = repo.status(match=match)[:4]
908 else:
908 else:
909 m, a, r, d = self.check_localchanges(repo, force=True)
909 m, a, r, d = self.check_localchanges(repo, force=True)
910 match = cmdutil.matchfiles(repo, m + a + r + inclsubs)
910 match = scmutil.matchfiles(repo, m + a + r + inclsubs)
911 if len(repo[None].parents()) > 1:
911 if len(repo[None].parents()) > 1:
912 raise util.Abort(_('cannot manage merge changesets'))
912 raise util.Abort(_('cannot manage merge changesets'))
913 commitfiles = m + a + r
913 commitfiles = m + a + r
@@ -1379,17 +1379,17 b' class queue(object):'
1379 changes = repo.changelog.read(top)
1379 changes = repo.changelog.read(top)
1380 man = repo.manifest.read(changes[0])
1380 man = repo.manifest.read(changes[0])
1381 aaa = aa[:]
1381 aaa = aa[:]
1382 matchfn = cmdutil.match(repo, pats, opts)
1382 matchfn = scmutil.match(repo, pats, opts)
1383 # in short mode, we only diff the files included in the
1383 # in short mode, we only diff the files included in the
1384 # patch already plus specified files
1384 # patch already plus specified files
1385 if opts.get('short'):
1385 if opts.get('short'):
1386 # if amending a patch, we start with existing
1386 # if amending a patch, we start with existing
1387 # files plus specified files - unfiltered
1387 # files plus specified files - unfiltered
1388 match = cmdutil.matchfiles(repo, mm + aa + dd + matchfn.files())
1388 match = scmutil.matchfiles(repo, mm + aa + dd + matchfn.files())
1389 # filter with inc/exl options
1389 # filter with inc/exl options
1390 matchfn = cmdutil.match(repo, opts=opts)
1390 matchfn = scmutil.match(repo, opts=opts)
1391 else:
1391 else:
1392 match = cmdutil.matchall(repo)
1392 match = scmutil.matchall(repo)
1393 m, a, r, d = repo.status(match=match)[:4]
1393 m, a, r, d = repo.status(match=match)[:4]
1394 mm = set(mm)
1394 mm = set(mm)
1395 aa = set(aa)
1395 aa = set(aa)
@@ -1427,7 +1427,7 b' class queue(object):'
1427 r = list(dd)
1427 r = list(dd)
1428 a = list(aa)
1428 a = list(aa)
1429 c = [filter(matchfn, l) for l in (m, a, r)]
1429 c = [filter(matchfn, l) for l in (m, a, r)]
1430 match = cmdutil.matchfiles(repo, set(c[0] + c[1] + c[2] + inclsubs))
1430 match = scmutil.matchfiles(repo, set(c[0] + c[1] + c[2] + inclsubs))
1431 chunks = patchmod.diff(repo, patchparent, match=match,
1431 chunks = patchmod.diff(repo, patchparent, match=match,
1432 changes=c, opts=diffopts)
1432 changes=c, opts=diffopts)
1433 for chunk in chunks:
1433 for chunk in chunks:
@@ -25,7 +25,7 b''
25
25
26 '''command to delete untracked files from the working directory'''
26 '''command to delete untracked files from the working directory'''
27
27
28 from mercurial import util, commands, cmdutil
28 from mercurial import util, commands, cmdutil, scmutil
29 from mercurial.i18n import _
29 from mercurial.i18n import _
30 import os, stat
30 import os, stat
31
31
@@ -96,7 +96,7 b' def purge(ui, repo, *dirs, **opts):'
96 os.remove(path)
96 os.remove(path)
97
97
98 directories = []
98 directories = []
99 match = cmdutil.match(repo, dirs, opts)
99 match = scmutil.match(repo, dirs, opts)
100 match.dir = directories.append
100 match.dir = directories.append
101 status = repo.status(match=match, ignored=opts['all'], unknown=True)
101 status = repo.status(match=match, ignored=opts['all'], unknown=True)
102
102
@@ -12,10 +12,6 b' import util, scmutil, templater, patch, '
12 import match as matchmod
12 import match as matchmod
13 import subrepo
13 import subrepo
14
14
15 match = scmutil.match
16 matchall = scmutil.matchall
17 matchfiles = scmutil.matchfiles
18
19 def parsealiases(cmd):
15 def parsealiases(cmd):
20 return cmd.lstrip("^").split("|")
16 return cmd.lstrip("^").split("|")
21
17
@@ -188,7 +184,7 b' def copy(ui, repo, pats, opts, rename=Fa'
188 def walkpat(pat):
184 def walkpat(pat):
189 srcs = []
185 srcs = []
190 badstates = after and '?' or '?r'
186 badstates = after and '?' or '?r'
191 m = match(repo, [pat], opts, globbed=True)
187 m = scmutil.match(repo, [pat], opts, globbed=True)
192 for abs in repo.walk(m):
188 for abs in repo.walk(m):
193 state = repo.dirstate[abs]
189 state = repo.dirstate[abs]
194 rel = m.rel(abs)
190 rel = m.rel(abs)
@@ -803,7 +799,7 b' def show_changeset(ui, repo, opts, buffe'
803 # options
799 # options
804 patch = False
800 patch = False
805 if opts.get('patch') or opts.get('stat'):
801 if opts.get('patch') or opts.get('stat'):
806 patch = matchall(repo)
802 patch = scmutil.matchall(repo)
807
803
808 tmpl = opts.get('template')
804 tmpl = opts.get('template')
809 style = None
805 style = None
@@ -844,7 +840,7 b' def finddate(ui, repo, date):'
844 """Find the tipmost changeset that matches the given date spec"""
840 """Find the tipmost changeset that matches the given date spec"""
845
841
846 df = util.matchdate(date)
842 df = util.matchdate(date)
847 m = matchall(repo)
843 m = scmutil.matchall(repo)
848 results = {}
844 results = {}
849
845
850 def prep(ctx, fns):
846 def prep(ctx, fns):
@@ -1135,7 +1131,7 b' def commit(ui, repo, commitfunc, pats, o'
1135 if opts.get('addremove'):
1131 if opts.get('addremove'):
1136 scmutil.addremove(repo, pats, opts)
1132 scmutil.addremove(repo, pats, opts)
1137
1133
1138 return commitfunc(ui, repo, message, match(repo, pats, opts), opts)
1134 return commitfunc(ui, repo, message, scmutil.match(repo, pats, opts), opts)
1139
1135
1140 def commiteditor(repo, ctx, subs):
1136 def commiteditor(repo, ctx, subs):
1141 if ctx.description():
1137 if ctx.description():
@@ -161,7 +161,7 b' def add(ui, repo, *pats, **opts):'
161 Returns 0 if all files are successfully added.
161 Returns 0 if all files are successfully added.
162 """
162 """
163
163
164 m = cmdutil.match(repo, pats, opts)
164 m = scmutil.match(repo, pats, opts)
165 rejected = cmdutil.add(ui, repo, m, opts.get('dry_run'),
165 rejected = cmdutil.add(ui, repo, m, opts.get('dry_run'),
166 opts.get('subrepos'), prefix="")
166 opts.get('subrepos'), prefix="")
167 return rejected and 1 or 0
167 return rejected and 1 or 0
@@ -262,7 +262,7 b' def annotate(ui, repo, *pats, **opts):'
262 raise util.Abort("%s: %s" % (x, y))
262 raise util.Abort("%s: %s" % (x, y))
263
263
264 ctx = scmutil.revsingle(repo, opts.get('rev'))
264 ctx = scmutil.revsingle(repo, opts.get('rev'))
265 m = cmdutil.match(repo, pats, opts)
265 m = scmutil.match(repo, pats, opts)
266 m.bad = bad
266 m.bad = bad
267 follow = not opts.get('no_follow')
267 follow = not opts.get('no_follow')
268 for abs in ctx.walk(m):
268 for abs in ctx.walk(m):
@@ -341,7 +341,7 b' def archive(ui, repo, dest, **opts):'
341 prefix = os.path.basename(repo.root) + '-%h'
341 prefix = os.path.basename(repo.root) + '-%h'
342
342
343 prefix = cmdutil.makefilename(repo, prefix, node)
343 prefix = cmdutil.makefilename(repo, prefix, node)
344 matchfn = cmdutil.match(repo, [], opts)
344 matchfn = scmutil.match(repo, [], opts)
345 archival.archive(repo, dest, node, kind, not opts.get('no_decode'),
345 archival.archive(repo, dest, node, kind, not opts.get('no_decode'),
346 matchfn, prefix, subrepos=opts.get('subrepos'))
346 matchfn, prefix, subrepos=opts.get('subrepos'))
347
347
@@ -937,7 +937,7 b' def cat(ui, repo, file1, *pats, **opts):'
937 """
937 """
938 ctx = scmutil.revsingle(repo, opts.get('rev'))
938 ctx = scmutil.revsingle(repo, opts.get('rev'))
939 err = 1
939 err = 1
940 m = cmdutil.match(repo, (file1,) + pats, opts)
940 m = scmutil.match(repo, (file1,) + pats, opts)
941 for abs in ctx.walk(m):
941 for abs in ctx.walk(m):
942 fp = cmdutil.makefileobj(repo, opts.get('output'), ctx.node(),
942 fp = cmdutil.makefileobj(repo, opts.get('output'), ctx.node(),
943 pathname=abs)
943 pathname=abs)
@@ -1084,7 +1084,7 b' def commit(ui, repo, *pats, **opts):'
1084
1084
1085 node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
1085 node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
1086 if not node:
1086 if not node:
1087 stat = repo.status(match=cmdutil.match(repo, pats, opts))
1087 stat = repo.status(match=scmutil.match(repo, pats, opts))
1088 if stat[3]:
1088 if stat[3]:
1089 ui.status(_("nothing changed (%d missing files, see 'hg status')\n")
1089 ui.status(_("nothing changed (%d missing files, see 'hg status')\n")
1090 % len(stat[3]))
1090 % len(stat[3]))
@@ -1845,7 +1845,7 b' def debugrename(ui, repo, file1, *pats, '
1845 """dump rename information"""
1845 """dump rename information"""
1846
1846
1847 ctx = scmutil.revsingle(repo, opts.get('rev'))
1847 ctx = scmutil.revsingle(repo, opts.get('rev'))
1848 m = cmdutil.match(repo, (file1,) + pats, opts)
1848 m = scmutil.match(repo, (file1,) + pats, opts)
1849 for abs in ctx.walk(m):
1849 for abs in ctx.walk(m):
1850 fctx = ctx[abs]
1850 fctx = ctx[abs]
1851 o = fctx.filelog().renamed(fctx.filenode())
1851 o = fctx.filelog().renamed(fctx.filenode())
@@ -2073,7 +2073,7 b' def debugsub(ui, repo, rev=None):'
2073 @command('debugwalk', walkopts, _('[OPTION]... [FILE]...'))
2073 @command('debugwalk', walkopts, _('[OPTION]... [FILE]...'))
2074 def debugwalk(ui, repo, *pats, **opts):
2074 def debugwalk(ui, repo, *pats, **opts):
2075 """show how files match on given patterns"""
2075 """show how files match on given patterns"""
2076 m = cmdutil.match(repo, pats, opts)
2076 m = scmutil.match(repo, pats, opts)
2077 items = list(repo.walk(m))
2077 items = list(repo.walk(m))
2078 if not items:
2078 if not items:
2079 return
2079 return
@@ -2159,7 +2159,7 b' def diff(ui, repo, *pats, **opts):'
2159 node1, node2 = node2, node1
2159 node1, node2 = node2, node1
2160
2160
2161 diffopts = patch.diffopts(ui, opts)
2161 diffopts = patch.diffopts(ui, opts)
2162 m = cmdutil.match(repo, pats, opts)
2162 m = scmutil.match(repo, pats, opts)
2163 cmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat,
2163 cmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat,
2164 listsubrepos=opts.get('subrepos'))
2164 listsubrepos=opts.get('subrepos'))
2165
2165
@@ -2239,7 +2239,7 b' def forget(ui, repo, *pats, **opts):'
2239 if not pats:
2239 if not pats:
2240 raise util.Abort(_('no files specified'))
2240 raise util.Abort(_('no files specified'))
2241
2241
2242 m = cmdutil.match(repo, pats, opts)
2242 m = scmutil.match(repo, pats, opts)
2243 s = repo.status(match=m, clean=True)
2243 s = repo.status(match=m, clean=True)
2244 forget = sorted(s[0] + s[1] + s[3] + s[6])
2244 forget = sorted(s[0] + s[1] + s[3] + s[6])
2245 errs = 0
2245 errs = 0
@@ -2404,7 +2404,7 b' def grep(ui, repo, pattern, *pats, **opt'
2404
2404
2405 skip = {}
2405 skip = {}
2406 revfiles = {}
2406 revfiles = {}
2407 matchfn = cmdutil.match(repo, pats, opts)
2407 matchfn = scmutil.match(repo, pats, opts)
2408 found = False
2408 found = False
2409 follow = opts.get('follow')
2409 follow = opts.get('follow')
2410
2410
@@ -3100,7 +3100,7 b' def import_(ui, repo, patch1, *patches, '
3100 if opts.get('exact'):
3100 if opts.get('exact'):
3101 m = None
3101 m = None
3102 else:
3102 else:
3103 m = cmdutil.matchfiles(repo, files or [])
3103 m = scmutil.matchfiles(repo, files or [])
3104 n = repo.commit(message, opts.get('user') or user,
3104 n = repo.commit(message, opts.get('user') or user,
3105 opts.get('date') or date, match=m,
3105 opts.get('date') or date, match=m,
3106 editor=cmdutil.commiteditor)
3106 editor=cmdutil.commiteditor)
@@ -3238,7 +3238,7 b' def locate(ui, repo, *pats, **opts):'
3238 rev = scmutil.revsingle(repo, opts.get('rev'), None).node()
3238 rev = scmutil.revsingle(repo, opts.get('rev'), None).node()
3239
3239
3240 ret = 1
3240 ret = 1
3241 m = cmdutil.match(repo, pats, opts, default='relglob')
3241 m = scmutil.match(repo, pats, opts, default='relglob')
3242 m.bad = lambda x, y: False
3242 m.bad = lambda x, y: False
3243 for abs in repo[rev].walk(m):
3243 for abs in repo[rev].walk(m):
3244 if not rev and abs not in repo.dirstate:
3244 if not rev and abs not in repo.dirstate:
@@ -3306,7 +3306,7 b' def log(ui, repo, *pats, **opts):'
3306 Returns 0 on success.
3306 Returns 0 on success.
3307 """
3307 """
3308
3308
3309 matchfn = cmdutil.match(repo, pats, opts)
3309 matchfn = scmutil.match(repo, pats, opts)
3310 limit = cmdutil.loglimit(opts)
3310 limit = cmdutil.loglimit(opts)
3311 count = 0
3311 count = 0
3312
3312
@@ -3359,7 +3359,7 b' def log(ui, repo, *pats, **opts):'
3359 if opts.get('patch') or opts.get('stat'):
3359 if opts.get('patch') or opts.get('stat'):
3360 if opts.get('follow') or opts.get('follow_first'):
3360 if opts.get('follow') or opts.get('follow_first'):
3361 # note: this might be wrong when following through merges
3361 # note: this might be wrong when following through merges
3362 revmatchfn = cmdutil.match(repo, fns, default='path')
3362 revmatchfn = scmutil.match(repo, fns, default='path')
3363 else:
3363 else:
3364 revmatchfn = matchfn
3364 revmatchfn = matchfn
3365
3365
@@ -3546,7 +3546,7 b' def parents(ui, repo, file_=None, **opts'
3546 ctx = scmutil.revsingle(repo, opts.get('rev'), None)
3546 ctx = scmutil.revsingle(repo, opts.get('rev'), None)
3547
3547
3548 if file_:
3548 if file_:
3549 m = cmdutil.match(repo, (file_,), opts)
3549 m = scmutil.match(repo, (file_,), opts)
3550 if m.anypats() or len(m.files()) != 1:
3550 if m.anypats() or len(m.files()) != 1:
3551 raise util.Abort(_('can only specify an explicit filename'))
3551 raise util.Abort(_('can only specify an explicit filename'))
3552 file_ = m.files()[0]
3552 file_ = m.files()[0]
@@ -3853,7 +3853,7 b' def remove(ui, repo, *pats, **opts):'
3853 if not pats and not after:
3853 if not pats and not after:
3854 raise util.Abort(_('no files specified'))
3854 raise util.Abort(_('no files specified'))
3855
3855
3856 m = cmdutil.match(repo, pats, opts)
3856 m = scmutil.match(repo, pats, opts)
3857 s = repo.status(match=m, clean=True)
3857 s = repo.status(match=m, clean=True)
3858 modified, added, deleted, clean = s[0], s[1], s[3], s[6]
3858 modified, added, deleted, clean = s[0], s[1], s[3], s[6]
3859
3859
@@ -3973,7 +3973,7 b' def resolve(ui, repo, *pats, **opts):'
3973 'use --all to remerge all files'))
3973 'use --all to remerge all files'))
3974
3974
3975 ms = mergemod.mergestate(repo)
3975 ms = mergemod.mergestate(repo)
3976 m = cmdutil.match(repo, pats, opts)
3976 m = scmutil.match(repo, pats, opts)
3977 ret = 0
3977 ret = 0
3978
3978
3979 for f in ms:
3979 for f in ms:
@@ -4092,7 +4092,7 b' def revert(ui, repo, *pats, **opts):'
4092 try:
4092 try:
4093 # walk dirstate.
4093 # walk dirstate.
4094
4094
4095 m = cmdutil.match(repo, pats, opts)
4095 m = scmutil.match(repo, pats, opts)
4096 m.bad = lambda x, y: False
4096 m.bad = lambda x, y: False
4097 for abs in repo.walk(m):
4097 for abs in repo.walk(m):
4098 names[abs] = m.rel(abs), m.exact(abs)
4098 names[abs] = m.rel(abs), m.exact(abs)
@@ -4108,13 +4108,13 b' def revert(ui, repo, *pats, **opts):'
4108 return
4108 return
4109 ui.warn("%s: %s\n" % (m.rel(path), msg))
4109 ui.warn("%s: %s\n" % (m.rel(path), msg))
4110
4110
4111 m = cmdutil.match(repo, pats, opts)
4111 m = scmutil.match(repo, pats, opts)
4112 m.bad = badfn
4112 m.bad = badfn
4113 for abs in repo[node].walk(m):
4113 for abs in repo[node].walk(m):
4114 if abs not in names:
4114 if abs not in names:
4115 names[abs] = m.rel(abs), m.exact(abs)
4115 names[abs] = m.rel(abs), m.exact(abs)
4116
4116
4117 m = cmdutil.matchfiles(repo, names)
4117 m = scmutil.matchfiles(repo, names)
4118 changes = repo.status(match=m)[:4]
4118 changes = repo.status(match=m)[:4]
4119 modified, added, removed, deleted = map(set, changes)
4119 modified, added, removed, deleted = map(set, changes)
4120
4120
@@ -4531,7 +4531,7 b' def status(ui, repo, *pats, **opts):'
4531 if not show:
4531 if not show:
4532 show = ui.quiet and states[:4] or states[:5]
4532 show = ui.quiet and states[:4] or states[:5]
4533
4533
4534 stat = repo.status(node1, node2, cmdutil.match(repo, pats, opts),
4534 stat = repo.status(node1, node2, scmutil.match(repo, pats, opts),
4535 'ignored' in show, 'clean' in show, 'unknown' in show,
4535 'ignored' in show, 'clean' in show, 'unknown' in show,
4536 opts.get('subrepos'))
4536 opts.get('subrepos'))
4537 changestates = zip(states, 'MAR!?IC', stat)
4537 changestates = zip(states, 'MAR!?IC', stat)
@@ -1,7 +1,7 b''
1 # Extension dedicated to test patch.diff() upgrade modes
1 # Extension dedicated to test patch.diff() upgrade modes
2 #
2 #
3 #
3 #
4 from mercurial import cmdutil, scmutil, patch, util
4 from mercurial import scmutil, patch, util
5
5
6 def autodiff(ui, repo, *pats, **opts):
6 def autodiff(ui, repo, *pats, **opts):
7 diffopts = patch.diffopts(ui, opts)
7 diffopts = patch.diffopts(ui, opts)
@@ -29,7 +29,7 b' def autodiff(ui, repo, *pats, **opts):'
29 raise util.Abort('--git must be yes, no or auto')
29 raise util.Abort('--git must be yes, no or auto')
30
30
31 node1, node2 = scmutil.revpair(repo, [])
31 node1, node2 = scmutil.revpair(repo, [])
32 m = cmdutil.match(repo, pats, opts)
32 m = scmutil.match(repo, pats, opts)
33 it = patch.diff(repo, node1, node2, match=m, opts=diffopts,
33 it = patch.diff(repo, node1, node2, match=m, opts=diffopts,
34 losedatafn=losedatafn)
34 losedatafn=losedatafn)
35 for chunk in it:
35 for chunk in it:
General Comments 0
You need to be logged in to leave comments. Login now