##// END OF EJS Templates
fileset: remove subset and unused filtering functions from matchctx
Yuya Nishihara -
r38713:370ff3e3 default
parent child Browse files
Show More
@@ -553,9 +553,8 b' methods = {'
553 }
553 }
554
554
555 class matchctx(object):
555 class matchctx(object):
556 def __init__(self, ctx, subset, status=None, badfn=None):
556 def __init__(self, ctx, status=None, badfn=None):
557 self.ctx = ctx
557 self.ctx = ctx
558 self.subset = subset
559 self._status = status
558 self._status = status
560 self._badfn = badfn
559 self._badfn = badfn
561
560
@@ -611,19 +610,14 b' class matchctx(object):'
611 return matchmod.nevermatcher(repo.root, repo.getcwd(),
610 return matchmod.nevermatcher(repo.root, repo.getcwd(),
612 badfn=self._badfn)
611 badfn=self._badfn)
613
612
614 def filter(self, files):
615 return [f for f in files if f in self.subset]
616
617 def switch(self, ctx, status=None):
613 def switch(self, ctx, status=None):
618 subset = self.filter(_buildsubset(ctx, status))
614 return matchctx(ctx, status, self._badfn)
619 return matchctx(ctx, subset, status, self._badfn)
620
615
621 class fullmatchctx(matchctx):
616 class fullmatchctx(matchctx):
622 """A match context where any files in any revisions should be valid"""
617 """A match context where any files in any revisions should be valid"""
623
618
624 def __init__(self, ctx, status=None, badfn=None):
619 def __init__(self, ctx, status=None, badfn=None):
625 subset = _buildsubset(ctx, status)
620 super(fullmatchctx, self).__init__(ctx, status, badfn)
626 super(fullmatchctx, self).__init__(ctx, subset, status, badfn)
627 def switch(self, ctx, status=None):
621 def switch(self, ctx, status=None):
628 return fullmatchctx(ctx, status, self._badfn)
622 return fullmatchctx(ctx, status, self._badfn)
629
623
@@ -646,15 +640,6 b' def _intree(funcs, tree):'
646 return True
640 return True
647 return False
641 return False
648
642
649 def _buildsubset(ctx, status):
650 if status:
651 subset = []
652 for c in status:
653 subset.extend(c)
654 return subset
655 else:
656 return list(ctx.walk(ctx.match([])))
657
658 def match(ctx, expr, badfn=None):
643 def match(ctx, expr, badfn=None):
659 """Create a matcher for a single fileset expression"""
644 """Create a matcher for a single fileset expression"""
660 tree = parse(expr)
645 tree = parse(expr)
General Comments 0
You need to be logged in to leave comments. Login now