changeset 38876:da3bd2afd68d

fileset: pass in basectx to _buildstatus() I'll make matchctx remember both ctx and basectx so that file status between them can be computed later. This prepares for the change.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 22 Jul 2018 10:55:38 +0900
parents 755741c39230
children 8d6780f0b34d
files mercurial/fileset.py
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/fileset.py	Sat Aug 04 12:58:08 2018 +0530
+++ b/mercurial/fileset.py	Sun Jul 22 10:55:38 2018 +0900
@@ -386,7 +386,8 @@
     matchers = []
     for r in revs:
         ctx = repo[r]
-        matchers.append(getmatch(mctx.switch(ctx, _buildstatus(ctx, x)), x))
+        mc = mctx.switch(ctx, _buildstatus(ctx.p1(), ctx, x))
+        matchers.append(getmatch(mc, x))
     if not matchers:
         return mctx.never()
     if len(matchers) == 1:
@@ -413,7 +414,8 @@
     if not revspec:
         raise error.ParseError(reverr)
     basectx, ctx = scmutil.revpair(repo, [baserevspec, revspec])
-    return getmatch(mctx.switch(ctx, _buildstatus(ctx, x, basectx=basectx)), x)
+    mc = mctx.switch(ctx, _buildstatus(basectx, ctx, x))
+    return getmatch(mc, x)
 
 @predicate('subrepo([pattern])')
 def subrepo(mctx, x):
@@ -538,18 +540,16 @@
     tree = filesetlang.parse(expr)
     tree = filesetlang.analyze(tree)
     tree = filesetlang.optimize(tree)
-    mctx = matchctx(ctx, _buildstatus(ctx, tree), badfn=badfn)
+    mctx = matchctx(ctx, _buildstatus(ctx.p1(), ctx, tree), badfn=badfn)
     return getmatch(mctx, tree)
 
-def _buildstatus(ctx, tree, basectx=None):
+def _buildstatus(basectx, ctx, tree):
     # do we need status info?
 
     if _intree(_statuscallers, tree):
         unknown = _intree(['unknown'], tree)
         ignored = _intree(['ignored'], tree)
 
-        if basectx is None:
-            basectx = ctx.p1()
         return basectx.status(ctx, listunknown=unknown, listignored=ignored,
                               listclean=True)
     else: