[PATCH 2 of 7] fileset: keep basectx by matchctx
Yuya Nishihara
yuya at tcha.org
Sun Aug 5 10:31:22 EDT 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1532224712 -32400
# Sun Jul 22 10:58:32 2018 +0900
# Node ID 733735d06e41efd01c7d21def2a9c00f465ad637
# Parent a3523d37efa3421b6593a920b25ef1e6680ac990
fileset: keep basectx by matchctx
diff --git a/mercurial/fileset.py b/mercurial/fileset.py
--- a/mercurial/fileset.py
+++ b/mercurial/fileset.py
@@ -386,7 +386,7 @@ def revs(mctx, x):
matchers = []
for r in revs:
ctx = repo[r]
- mc = mctx.switch(ctx, _buildstatus(ctx.p1(), ctx, x))
+ mc = mctx.switch(ctx.p1(), ctx, _buildstatus(ctx.p1(), ctx, x))
matchers.append(getmatch(mc, x))
if not matchers:
return mctx.never()
@@ -414,7 +414,7 @@ def status(mctx, x):
if not revspec:
raise error.ParseError(reverr)
basectx, ctx = scmutil.revpair(repo, [baserevspec, revspec])
- mc = mctx.switch(ctx, _buildstatus(basectx, ctx, x))
+ mc = mctx.switch(basectx, ctx, _buildstatus(basectx, ctx, x))
return getmatch(mc, x)
@predicate('subrepo([pattern])')
@@ -454,7 +454,8 @@ methods = {
}
class matchctx(object):
- def __init__(self, ctx, status=None, badfn=None):
+ def __init__(self, basectx, ctx, status=None, badfn=None):
+ self._basectx = basectx
self.ctx = ctx
self._status = status
self._badfn = badfn
@@ -513,8 +514,8 @@ class matchctx(object):
return matchmod.nevermatcher(repo.root, repo.getcwd(),
badfn=self._badfn)
- def switch(self, ctx, status=None):
- return matchctx(ctx, status, self._badfn)
+ def switch(self, basectx, ctx, status=None):
+ return matchctx(basectx, ctx, status, self._badfn)
# filesets using matchctx.switch()
_switchcallers = [
@@ -540,7 +541,8 @@ def match(ctx, expr, badfn=None):
tree = filesetlang.parse(expr)
tree = filesetlang.analyze(tree)
tree = filesetlang.optimize(tree)
- mctx = matchctx(ctx, _buildstatus(ctx.p1(), ctx, tree), badfn=badfn)
+ mctx = matchctx(ctx.p1(), ctx, _buildstatus(ctx.p1(), ctx, tree),
+ badfn=badfn)
return getmatch(mctx, tree)
def _buildstatus(basectx, ctx, tree):
More information about the Mercurial-devel
mailing list