# HG changeset patch # User Yuya Nishihara # Date 1516509631 -32400 # Node ID f8ad57d242521d0fe5c81c347eef9d49e7172607 # Parent 91aac8e6604d1aa08b2683c1d4c7d1936f226e48 log: pass ctx to makefilematcher() and makehunksfilter() functions This isn't important, but seems more consistent as changesetprinter.show() takes a ctx, not a revision number. diff -r 91aac8e6604d -r f8ad57d24252 hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py Sat Jan 27 19:02:33 2018 -0500 +++ b/hgext/largefiles/overrides.py Sun Jan 21 13:40:31 2018 +0900 @@ -392,7 +392,7 @@ def overridemakefilematcher(repo, pats, opts, badfn=None): wctx = repo[None] match, pats = oldmatchandpats(wctx, pats, opts, badfn=badfn) - return lambda rev: match + return lambda ctx: match oldmatchandpats = installmatchandpatsfn(overridematchandpats) oldmakefilematcher = logcmdutil._makenofollowfilematcher diff -r 91aac8e6604d -r f8ad57d24252 mercurial/commands.py --- a/mercurial/commands.py Sat Jan 27 19:02:33 2018 -0500 +++ b/mercurial/commands.py Sun Jan 21 13:40:31 2018 +0900 @@ -3461,11 +3461,11 @@ if rename: copies.append((fn, rename[0])) if filematcher: - revmatchfn = filematcher(ctx.rev()) + revmatchfn = filematcher(ctx) else: revmatchfn = None if hunksfilter: - revhunksfilter = hunksfilter(rev) + revhunksfilter = hunksfilter(ctx) else: revhunksfilter = None displayer.show(ctx, copies=copies, matchfn=revmatchfn, diff -r 91aac8e6604d -r f8ad57d24252 mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py Sat Jan 27 19:02:33 2018 -0500 +++ b/mercurial/logcmdutil.py Sun Jan 21 13:40:31 2018 +0900 @@ -627,8 +627,8 @@ # revision, stored in "fcache". "fcache" is populated as a side effect # of the graph traversal. fcache = {} - def filematcher(rev): - return scmutil.matchfiles(repo, fcache.get(rev, [])) + def filematcher(ctx): + return scmutil.matchfiles(repo, fcache.get(ctx.rev(), [])) def revgen(): for rev, cs in dagop.filectxancestors(fctxs, followfirst=followfirst): @@ -722,7 +722,7 @@ def getrevs(repo, pats, opts): """Return (revs, filematcher) where revs is a smartset - filematcher is a callable taking a revision number and returning a match + filematcher is a callable taking a changectx and returning a match objects filtering the files to be detailed when displaying the revision. """ follow = opts.get('follow') or opts.get('follow_first') @@ -742,7 +742,7 @@ if filematcher is None: filematcher = _makenofollowfilematcher(repo, pats, opts) if filematcher is None: - def filematcher(rev): + def filematcher(ctx): return match expr = _makerevset(repo, match, pats, slowpath, opts) @@ -784,11 +784,11 @@ "revs" are revisions obtained by processing "line-range" log options and walking block ancestors of each specified file/line-range. - "filematcher(rev) -> match" is a factory function returning a match object + "filematcher(ctx) -> match" is a factory function returning a match object for a given revision for file patterns specified in --line-range option. If neither --stat nor --patch options are passed, "filematcher" is None. - "hunksfilter(rev) -> filterfn(fctx, hunks)" is a factory function + "hunksfilter(ctx) -> filterfn(fctx, hunks)" is a factory function returning a hunks filtering function. If neither --stat nor --patch options are passed, "filterhunks" is None. """ @@ -816,8 +816,8 @@ def nofilterhunksfn(fctx, hunks): return hunks - def hunksfilter(rev): - fctxlineranges = linerangesbyrev.get(rev) + def hunksfilter(ctx): + fctxlineranges = linerangesbyrev.get(ctx.rev()) if fctxlineranges is None: return nofilterhunksfn @@ -837,8 +837,8 @@ return filterfn - def filematcher(rev): - files = list(linerangesbyrev.get(rev, [])) + def filematcher(ctx): + files = list(linerangesbyrev.get(ctx.rev(), [])) return scmutil.matchfiles(repo, files) revs = sorted(linerangesbyrev, reverse=True) @@ -899,7 +899,7 @@ copies.append((fn, rename[0])) revmatchfn = None if filematcher is not None: - revmatchfn = filematcher(ctx.rev()) + revmatchfn = filematcher(ctx) edges = edgefn(type, char, state, rev, parents) firstedge = next(edges) width = firstedge[2]