# HG changeset patch # User Yuya Nishihara # Date 1532224538 -32400 # Node ID da3bd2afd68da92a6fca172bcd948b0d324b026a # Parent 755741c39230ba0d1db42b8e8d6355ce60a02346 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. diff -r 755741c39230 -r da3bd2afd68d mercurial/fileset.py --- 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: