##// END OF EJS Templates
fileset: keep basectx by matchctx
Yuya Nishihara -
r38913:8d6780f0 default
parent child Browse files
Show More
@@ -386,7 +386,7 b' def revs(mctx, x):'
386 matchers = []
386 matchers = []
387 for r in revs:
387 for r in revs:
388 ctx = repo[r]
388 ctx = repo[r]
389 mc = mctx.switch(ctx, _buildstatus(ctx.p1(), ctx, x))
389 mc = mctx.switch(ctx.p1(), ctx, _buildstatus(ctx.p1(), ctx, x))
390 matchers.append(getmatch(mc, x))
390 matchers.append(getmatch(mc, x))
391 if not matchers:
391 if not matchers:
392 return mctx.never()
392 return mctx.never()
@@ -414,7 +414,7 b' def status(mctx, x):'
414 if not revspec:
414 if not revspec:
415 raise error.ParseError(reverr)
415 raise error.ParseError(reverr)
416 basectx, ctx = scmutil.revpair(repo, [baserevspec, revspec])
416 basectx, ctx = scmutil.revpair(repo, [baserevspec, revspec])
417 mc = mctx.switch(ctx, _buildstatus(basectx, ctx, x))
417 mc = mctx.switch(basectx, ctx, _buildstatus(basectx, ctx, x))
418 return getmatch(mc, x)
418 return getmatch(mc, x)
419
419
420 @predicate('subrepo([pattern])')
420 @predicate('subrepo([pattern])')
@@ -454,7 +454,8 b' methods = {'
454 }
454 }
455
455
456 class matchctx(object):
456 class matchctx(object):
457 def __init__(self, ctx, status=None, badfn=None):
457 def __init__(self, basectx, ctx, status=None, badfn=None):
458 self._basectx = basectx
458 self.ctx = ctx
459 self.ctx = ctx
459 self._status = status
460 self._status = status
460 self._badfn = badfn
461 self._badfn = badfn
@@ -513,8 +514,8 b' class matchctx(object):'
513 return matchmod.nevermatcher(repo.root, repo.getcwd(),
514 return matchmod.nevermatcher(repo.root, repo.getcwd(),
514 badfn=self._badfn)
515 badfn=self._badfn)
515
516
516 def switch(self, ctx, status=None):
517 def switch(self, basectx, ctx, status=None):
517 return matchctx(ctx, status, self._badfn)
518 return matchctx(basectx, ctx, status, self._badfn)
518
519
519 # filesets using matchctx.switch()
520 # filesets using matchctx.switch()
520 _switchcallers = [
521 _switchcallers = [
@@ -540,7 +541,8 b' def match(ctx, expr, badfn=None):'
540 tree = filesetlang.parse(expr)
541 tree = filesetlang.parse(expr)
541 tree = filesetlang.analyze(tree)
542 tree = filesetlang.analyze(tree)
542 tree = filesetlang.optimize(tree)
543 tree = filesetlang.optimize(tree)
543 mctx = matchctx(ctx, _buildstatus(ctx.p1(), ctx, tree), badfn=badfn)
544 mctx = matchctx(ctx.p1(), ctx, _buildstatus(ctx.p1(), ctx, tree),
545 badfn=badfn)
544 return getmatch(mctx, tree)
546 return getmatch(mctx, tree)
545
547
546 def _buildstatus(basectx, ctx, tree):
548 def _buildstatus(basectx, ctx, tree):
General Comments 0
You need to be logged in to leave comments. Login now