Show More
@@ -31,11 +31,11 b' def timer(func, title=None):' | |||
|
31 | 31 | |
|
32 | 32 | def perfwalk(ui, repo, *pats): |
|
33 | 33 | try: |
|
34 | m = scmutil.match(repo, pats, {}) | |
|
34 | m = scmutil.match(repo[None], pats, {}) | |
|
35 | 35 | timer(lambda: len(list(repo.dirstate.walk(m, [], True, False)))) |
|
36 | 36 | except: |
|
37 | 37 | try: |
|
38 | m = scmutil.match(repo, pats, {}) | |
|
38 | m = scmutil.match(repo[None], pats, {}) | |
|
39 | 39 | timer(lambda: len([b for a, b, c in repo.dirstate.statwalk([], m)])) |
|
40 | 40 | except: |
|
41 | 41 | timer(lambda: len(list(cmdutil.walk(repo, pats, {})))) |
@@ -54,7 +54,7 b' def countrate(ui, repo, amap, *pats, **o' | |||
|
54 | 54 | if opts.get('date'): |
|
55 | 55 | df = util.matchdate(opts['date']) |
|
56 | 56 | |
|
57 | m = scmutil.match(repo, pats, opts) | |
|
57 | m = scmutil.match(repo[None], pats, opts) | |
|
58 | 58 | def prep(ctx, fns): |
|
59 | 59 | rev = ctx.rev() |
|
60 | 60 | if df and not df(ctx.date()[0]): # doesn't match date format |
@@ -137,7 +137,7 b' def dodiff(ui, repo, diffcmd, diffopts, ' | |||
|
137 | 137 | if node1b == nullid: |
|
138 | 138 | do3way = False |
|
139 | 139 | |
|
140 | matcher = scmutil.match(repo, pats, opts) | |
|
140 | matcher = scmutil.match(repo[node2], pats, opts) | |
|
141 | 141 | mod_a, add_a, rem_a = map(set, repo.status(node1a, node2, matcher)[:3]) |
|
142 | 142 | if do3way: |
|
143 | 143 | mod_b, add_b, rem_b = map(set, repo.status(node1b, node2, matcher)[:3]) |
@@ -45,7 +45,7 b' def difftree(ui, repo, node1=None, node2' | |||
|
45 | 45 | assert node2 is not None |
|
46 | 46 | mmap = repo[node1].manifest() |
|
47 | 47 | mmap2 = repo[node2].manifest() |
|
48 | m = scmutil.match(repo, files) | |
|
48 | m = scmutil.match(repo[node1], files) | |
|
49 | 49 | modified, added, removed = repo.status(node1, node2, m)[:3] |
|
50 | 50 | empty = short(nullid) |
|
51 | 51 | |
@@ -81,7 +81,7 b' def difftree(ui, repo, node1=None, node2' | |||
|
81 | 81 | if opts['patch']: |
|
82 | 82 | if opts['pretty']: |
|
83 | 83 | catcommit(ui, repo, node2, "") |
|
84 | m = scmutil.match(repo, files) | |
|
84 | m = scmutil.match(repo[node1], files) | |
|
85 | 85 | chunks = patch.diff(repo, node1, node2, match=m, |
|
86 | 86 | opts=patch.diffopts(ui, {'git': True})) |
|
87 | 87 | for chunk in chunks: |
@@ -326,7 +326,7 b' def _status(ui, repo, kwt, *pats, **opts' | |||
|
326 | 326 | '''Bails out if [keyword] configuration is not active. |
|
327 | 327 | Returns status of working directory.''' |
|
328 | 328 | if kwt: |
|
329 | return repo.status(match=scmutil.match(repo, pats, opts), clean=True, | |
|
329 | return repo.status(match=scmutil.match(repo[None], pats, opts), clean=True, | |
|
330 | 330 | unknown=opts.get('unknown') or opts.get('all')) |
|
331 | 331 | if ui.configitems('keyword'): |
|
332 | 332 | raise util.Abort(_('[keyword] patterns cannot match')) |
@@ -519,7 +519,7 b' class queue(object):' | |||
|
519 | 519 | def printdiff(self, repo, diffopts, node1, node2=None, files=None, |
|
520 | 520 | fp=None, changes=None, opts={}): |
|
521 | 521 | stat = opts.get('stat') |
|
522 | m = scmutil.match(repo, files, opts) | |
|
522 | m = scmutil.match(repo[node1], files, opts) | |
|
523 | 523 | cmdutil.diffordiffstat(self.ui, repo, diffopts, node1, node2, m, |
|
524 | 524 | changes, stat, fp) |
|
525 | 525 | |
@@ -899,7 +899,7 b' class queue(object):' | |||
|
899 | 899 | if opts.get('include') or opts.get('exclude') or pats: |
|
900 | 900 | if inclsubs: |
|
901 | 901 | pats = list(pats or []) + inclsubs |
|
902 | match = scmutil.match(repo, pats, opts) | |
|
902 | match = scmutil.match(repo[None], pats, opts) | |
|
903 | 903 | # detect missing files in pats |
|
904 | 904 | def badfn(f, msg): |
|
905 | 905 | if f != '.hgsubstate': # .hgsubstate is auto-created |
@@ -1380,7 +1380,7 b' class queue(object):' | |||
|
1380 | 1380 | changes = repo.changelog.read(top) |
|
1381 | 1381 | man = repo.manifest.read(changes[0]) |
|
1382 | 1382 | aaa = aa[:] |
|
1383 | matchfn = scmutil.match(repo, pats, opts) | |
|
1383 | matchfn = scmutil.match(repo[None], pats, opts) | |
|
1384 | 1384 | # in short mode, we only diff the files included in the |
|
1385 | 1385 | # patch already plus specified files |
|
1386 | 1386 | if opts.get('short'): |
@@ -1388,7 +1388,7 b' class queue(object):' | |||
|
1388 | 1388 | # files plus specified files - unfiltered |
|
1389 | 1389 | match = scmutil.matchfiles(repo, mm + aa + dd + matchfn.files()) |
|
1390 | 1390 | # filter with inc/exl options |
|
1391 | matchfn = scmutil.match(repo, opts=opts) | |
|
1391 | matchfn = scmutil.match(repo[None], opts=opts) | |
|
1392 | 1392 | else: |
|
1393 | 1393 | match = scmutil.matchall(repo) |
|
1394 | 1394 | m, a, r, d = repo.status(match=match)[:4] |
@@ -96,7 +96,7 b' def purge(ui, repo, *dirs, **opts):' | |||
|
96 | 96 | os.remove(path) |
|
97 | 97 | |
|
98 | 98 | directories = [] |
|
99 | match = scmutil.match(repo, dirs, opts) | |
|
99 | match = scmutil.match(repo[None], dirs, opts) | |
|
100 | 100 | match.dir = directories.append |
|
101 | 101 | status = repo.status(match=match, ignored=opts['all'], unknown=True) |
|
102 | 102 |
@@ -234,7 +234,7 b' def copy(ui, repo, pats, opts, rename=Fa' | |||
|
234 | 234 | def walkpat(pat): |
|
235 | 235 | srcs = [] |
|
236 | 236 | badstates = after and '?' or '?r' |
|
237 | m = scmutil.match(repo, [pat], opts, globbed=True) | |
|
237 | m = scmutil.match(repo[None], [pat], opts, globbed=True) | |
|
238 | 238 | for abs in repo.walk(m): |
|
239 | 239 | state = repo.dirstate[abs] |
|
240 | 240 | rel = m.rel(abs) |
@@ -1185,7 +1185,8 b' def commit(ui, repo, commitfunc, pats, o' | |||
|
1185 | 1185 | if opts.get('addremove'): |
|
1186 | 1186 | scmutil.addremove(repo, pats, opts) |
|
1187 | 1187 | |
|
1188 |
return commitfunc(ui, repo, message, |
|
|
1188 | return commitfunc(ui, repo, message, | |
|
1189 | scmutil.match(repo[None], pats, opts), opts) | |
|
1189 | 1190 | |
|
1190 | 1191 | def commiteditor(repo, ctx, subs): |
|
1191 | 1192 | if ctx.description(): |
@@ -162,7 +162,7 b' def add(ui, repo, *pats, **opts):' | |||
|
162 | 162 | Returns 0 if all files are successfully added. |
|
163 | 163 | """ |
|
164 | 164 | |
|
165 | m = scmutil.match(repo, pats, opts) | |
|
165 | m = scmutil.match(repo[None], pats, opts) | |
|
166 | 166 | rejected = cmdutil.add(ui, repo, m, opts.get('dry_run'), |
|
167 | 167 | opts.get('subrepos'), prefix="") |
|
168 | 168 | return rejected and 1 or 0 |
@@ -262,7 +262,7 b' def annotate(ui, repo, *pats, **opts):' | |||
|
262 | 262 | raise util.Abort("%s: %s" % (x, y)) |
|
263 | 263 | |
|
264 | 264 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
265 |
m = scmutil.match( |
|
|
265 | m = scmutil.match(ctx, pats, opts) | |
|
266 | 266 | m.bad = bad |
|
267 | 267 | follow = not opts.get('no_follow') |
|
268 | 268 | for abs in ctx.walk(m): |
@@ -342,7 +342,7 b' def archive(ui, repo, dest, **opts):' | |||
|
342 | 342 | prefix = os.path.basename(repo.root) + '-%h' |
|
343 | 343 | |
|
344 | 344 | prefix = cmdutil.makefilename(repo, prefix, node) |
|
345 |
matchfn = scmutil.match( |
|
|
345 | matchfn = scmutil.match(ctx, [], opts) | |
|
346 | 346 | archival.archive(repo, dest, node, kind, not opts.get('no_decode'), |
|
347 | 347 | matchfn, prefix, subrepos=opts.get('subrepos')) |
|
348 | 348 | |
@@ -944,7 +944,7 b' def cat(ui, repo, file1, *pats, **opts):' | |||
|
944 | 944 | """ |
|
945 | 945 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
946 | 946 | err = 1 |
|
947 |
m = scmutil.match( |
|
|
947 | m = scmutil.match(ctx, (file1,) + pats, opts) | |
|
948 | 948 | for abs in ctx.walk(m): |
|
949 | 949 | fp = cmdutil.makefileobj(repo, opts.get('output'), ctx.node(), |
|
950 | 950 | pathname=abs) |
@@ -1091,7 +1091,7 b' def commit(ui, repo, *pats, **opts):' | |||
|
1091 | 1091 | |
|
1092 | 1092 | node = cmdutil.commit(ui, repo, commitfunc, pats, opts) |
|
1093 | 1093 | if not node: |
|
1094 | stat = repo.status(match=scmutil.match(repo, pats, opts)) | |
|
1094 | stat = repo.status(match=scmutil.match(repo[None], pats, opts)) | |
|
1095 | 1095 | if stat[3]: |
|
1096 | 1096 | ui.status(_("nothing changed (%d missing files, see 'hg status')\n") |
|
1097 | 1097 | % len(stat[3])) |
@@ -1610,7 +1610,7 b' def debugfileset(ui, repo, expr):' | |||
|
1610 | 1610 | if ui.verbose: |
|
1611 | 1611 | tree = fileset.parse(expr)[0] |
|
1612 | 1612 | ui.note(tree, "\n") |
|
1613 | matcher = lambda x: scmutil.match(repo, x, default='glob') | |
|
1613 | matcher = lambda x: scmutil.match(repo[None], x, default='glob') | |
|
1614 | 1614 | |
|
1615 | 1615 | for f in fileset.getfileset(repo[None], matcher, expr): |
|
1616 | 1616 | ui.write("%s\n" % f) |
@@ -1857,7 +1857,7 b' def debugrename(ui, repo, file1, *pats, ' | |||
|
1857 | 1857 | """dump rename information""" |
|
1858 | 1858 | |
|
1859 | 1859 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
1860 |
m = scmutil.match( |
|
|
1860 | m = scmutil.match(ctx, (file1,) + pats, opts) | |
|
1861 | 1861 | for abs in ctx.walk(m): |
|
1862 | 1862 | fctx = ctx[abs] |
|
1863 | 1863 | o = fctx.filelog().renamed(fctx.filenode()) |
@@ -2106,7 +2106,7 b' def debugsub(ui, repo, rev=None):' | |||
|
2106 | 2106 | @command('debugwalk', walkopts, _('[OPTION]... [FILE]...')) |
|
2107 | 2107 | def debugwalk(ui, repo, *pats, **opts): |
|
2108 | 2108 | """show how files match on given patterns""" |
|
2109 | m = scmutil.match(repo, pats, opts) | |
|
2109 | m = scmutil.match(repo[None], pats, opts) | |
|
2110 | 2110 | items = list(repo.walk(m)) |
|
2111 | 2111 | if not items: |
|
2112 | 2112 | return |
@@ -2192,7 +2192,7 b' def diff(ui, repo, *pats, **opts):' | |||
|
2192 | 2192 | node1, node2 = node2, node1 |
|
2193 | 2193 | |
|
2194 | 2194 | diffopts = patch.diffopts(ui, opts) |
|
2195 | m = scmutil.match(repo, pats, opts) | |
|
2195 | m = scmutil.match(repo[node2], pats, opts) | |
|
2196 | 2196 | cmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat, |
|
2197 | 2197 | listsubrepos=opts.get('subrepos')) |
|
2198 | 2198 | |
@@ -2272,7 +2272,7 b' def forget(ui, repo, *pats, **opts):' | |||
|
2272 | 2272 | if not pats: |
|
2273 | 2273 | raise util.Abort(_('no files specified')) |
|
2274 | 2274 | |
|
2275 | m = scmutil.match(repo, pats, opts) | |
|
2275 | m = scmutil.match(repo[None], pats, opts) | |
|
2276 | 2276 | s = repo.status(match=m, clean=True) |
|
2277 | 2277 | forget = sorted(s[0] + s[1] + s[3] + s[6]) |
|
2278 | 2278 | errs = 0 |
@@ -2438,7 +2438,7 b' def grep(ui, repo, pattern, *pats, **opt' | |||
|
2438 | 2438 | |
|
2439 | 2439 | skip = {} |
|
2440 | 2440 | revfiles = {} |
|
2441 | matchfn = scmutil.match(repo, pats, opts) | |
|
2441 | matchfn = scmutil.match(repo[None], pats, opts) | |
|
2442 | 2442 | found = False |
|
2443 | 2443 | follow = opts.get('follow') |
|
2444 | 2444 | |
@@ -3313,7 +3313,7 b' def locate(ui, repo, *pats, **opts):' | |||
|
3313 | 3313 | rev = scmutil.revsingle(repo, opts.get('rev'), None).node() |
|
3314 | 3314 | |
|
3315 | 3315 | ret = 1 |
|
3316 | m = scmutil.match(repo, pats, opts, default='relglob') | |
|
3316 | m = scmutil.match(repo[rev], pats, opts, default='relglob') | |
|
3317 | 3317 | m.bad = lambda x, y: False |
|
3318 | 3318 | for abs in repo[rev].walk(m): |
|
3319 | 3319 | if not rev and abs not in repo.dirstate: |
@@ -3382,7 +3382,7 b' def log(ui, repo, *pats, **opts):' | |||
|
3382 | 3382 | Returns 0 on success. |
|
3383 | 3383 | """ |
|
3384 | 3384 | |
|
3385 | matchfn = scmutil.match(repo, pats, opts) | |
|
3385 | matchfn = scmutil.match(repo[None], pats, opts) | |
|
3386 | 3386 | limit = cmdutil.loglimit(opts) |
|
3387 | 3387 | count = 0 |
|
3388 | 3388 | |
@@ -3437,7 +3437,7 b' def log(ui, repo, *pats, **opts):' | |||
|
3437 | 3437 | if opts.get('patch') or opts.get('stat'): |
|
3438 | 3438 | if opts.get('follow') or opts.get('follow_first'): |
|
3439 | 3439 | # note: this might be wrong when following through merges |
|
3440 | revmatchfn = scmutil.match(repo, fns, default='path') | |
|
3440 | revmatchfn = scmutil.match(repo[None], fns, default='path') | |
|
3441 | 3441 | else: |
|
3442 | 3442 | revmatchfn = matchfn |
|
3443 | 3443 | |
@@ -3650,7 +3650,7 b' def parents(ui, repo, file_=None, **opts' | |||
|
3650 | 3650 | ctx = scmutil.revsingle(repo, opts.get('rev'), None) |
|
3651 | 3651 | |
|
3652 | 3652 | if file_: |
|
3653 |
m = scmutil.match( |
|
|
3653 | m = scmutil.match(ctx, (file_,), opts) | |
|
3654 | 3654 | if m.anypats() or len(m.files()) != 1: |
|
3655 | 3655 | raise util.Abort(_('can only specify an explicit filename')) |
|
3656 | 3656 | file_ = m.files()[0] |
@@ -3968,7 +3968,7 b' def remove(ui, repo, *pats, **opts):' | |||
|
3968 | 3968 | if not pats and not after: |
|
3969 | 3969 | raise util.Abort(_('no files specified')) |
|
3970 | 3970 | |
|
3971 | m = scmutil.match(repo, pats, opts) | |
|
3971 | m = scmutil.match(repo[None], pats, opts) | |
|
3972 | 3972 | s = repo.status(match=m, clean=True) |
|
3973 | 3973 | modified, added, deleted, clean = s[0], s[1], s[3], s[6] |
|
3974 | 3974 | |
@@ -4102,7 +4102,7 b' def resolve(ui, repo, *pats, **opts):' | |||
|
4102 | 4102 | 'use --all to remerge all files')) |
|
4103 | 4103 | |
|
4104 | 4104 | ms = mergemod.mergestate(repo) |
|
4105 | m = scmutil.match(repo, pats, opts) | |
|
4105 | m = scmutil.match(repo[None], pats, opts) | |
|
4106 | 4106 | ret = 0 |
|
4107 | 4107 | |
|
4108 | 4108 | for f in ms: |
@@ -4203,7 +4203,7 b' def revert(ui, repo, *pats, **opts):' | |||
|
4203 | 4203 | try: |
|
4204 | 4204 | # walk dirstate. |
|
4205 | 4205 | |
|
4206 | m = scmutil.match(repo, pats, opts) | |
|
4206 | m = scmutil.match(repo[None], pats, opts) | |
|
4207 | 4207 | m.bad = lambda x, y: False |
|
4208 | 4208 | for abs in repo.walk(m): |
|
4209 | 4209 | names[abs] = m.rel(abs), m.exact(abs) |
@@ -4219,7 +4219,7 b' def revert(ui, repo, *pats, **opts):' | |||
|
4219 | 4219 | return |
|
4220 | 4220 | ui.warn("%s: %s\n" % (m.rel(path), msg)) |
|
4221 | 4221 | |
|
4222 | m = scmutil.match(repo, pats, opts) | |
|
4222 | m = scmutil.match(repo[node], pats, opts) | |
|
4223 | 4223 | m.bad = badfn |
|
4224 | 4224 | for abs in repo[node].walk(m): |
|
4225 | 4225 | if abs not in names: |
@@ -4654,7 +4654,7 b' def status(ui, repo, *pats, **opts):' | |||
|
4654 | 4654 | if not show: |
|
4655 | 4655 | show = ui.quiet and states[:4] or states[:5] |
|
4656 | 4656 | |
|
4657 | stat = repo.status(node1, node2, scmutil.match(repo, pats, opts), | |
|
4657 | stat = repo.status(node1, node2, scmutil.match(repo[node2], pats, opts), | |
|
4658 | 4658 | 'ignored' in show, 'clean' in show, 'unknown' in show, |
|
4659 | 4659 | opts.get('subrepos')) |
|
4660 | 4660 | changestates = zip(states, 'MAR!?IC', stat) |
@@ -573,7 +573,7 b' def match(ctxorrepo, pats=[], opts={}, g' | |||
|
573 | 573 | m = ctx.match(pats, opts.get('include'), opts.get('exclude'), |
|
574 | 574 | default) |
|
575 | 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 | 577 | m.bad = badfn |
|
578 | 578 | return m |
|
579 | 579 | |
@@ -591,7 +591,7 b' def addremove(repo, pats=[], opts={}, dr' | |||
|
591 | 591 | # we'd use status here, except handling of symlinks and ignore is tricky |
|
592 | 592 | added, unknown, deleted, removed = [], [], [], [] |
|
593 | 593 | audit_path = pathauditor(repo.root) |
|
594 | m = match(repo, pats, opts) | |
|
594 | m = match(repo[None], pats, opts) | |
|
595 | 595 | for abs in repo.walk(m): |
|
596 | 596 | target = repo.wjoin(abs) |
|
597 | 597 | good = True |
@@ -29,7 +29,7 b' def autodiff(ui, repo, *pats, **opts):' | |||
|
29 | 29 | raise util.Abort('--git must be yes, no or auto') |
|
30 | 30 | |
|
31 | 31 | node1, node2 = scmutil.revpair(repo, []) |
|
32 | m = scmutil.match(repo, pats, opts) | |
|
32 | m = scmutil.match(repo[node2], pats, opts) | |
|
33 | 33 | it = patch.diff(repo, node1, node2, match=m, opts=diffopts, |
|
34 | 34 | losedatafn=losedatafn) |
|
35 | 35 | for chunk in it: |
General Comments 0
You need to be logged in to leave comments.
Login now