Patchwork [8,of,9] fileset: remove subset and unused filtering functions from matchctx

login
register
mail settings
Submitter Yuya Nishihara
Date July 10, 2018, 3:07 p.m.
Message ID <87bb964e745e47fc897f.1531235266@mimosa>
Download mbox | patch
Permalink /patch/32767/
State Accepted
Headers show

Comments

Yuya Nishihara - July 10, 2018, 3:07 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1528551321 -32400
#      Sat Jun 09 22:35:21 2018 +0900
# Node ID 87bb964e745e47fc897f56864b66e9a8e986301d
# Parent  4f00b1591bc243d1b0cfebdd15fad04407f8c653
fileset: remove subset and unused filtering functions from matchctx

Patch

diff --git a/mercurial/fileset.py b/mercurial/fileset.py
--- a/mercurial/fileset.py
+++ b/mercurial/fileset.py
@@ -553,9 +553,8 @@  methods = {
 }
 
 class matchctx(object):
-    def __init__(self, ctx, subset, status=None, badfn=None):
+    def __init__(self, ctx, status=None, badfn=None):
         self.ctx = ctx
-        self.subset = subset
         self._status = status
         self._badfn = badfn
 
@@ -611,19 +610,14 @@  class matchctx(object):
         return matchmod.nevermatcher(repo.root, repo.getcwd(),
                                      badfn=self._badfn)
 
-    def filter(self, files):
-        return [f for f in files if f in self.subset]
-
     def switch(self, ctx, status=None):
-        subset = self.filter(_buildsubset(ctx, status))
-        return matchctx(ctx, subset, status, self._badfn)
+        return matchctx(ctx, status, self._badfn)
 
 class fullmatchctx(matchctx):
     """A match context where any files in any revisions should be valid"""
 
     def __init__(self, ctx, status=None, badfn=None):
-        subset = _buildsubset(ctx, status)
-        super(fullmatchctx, self).__init__(ctx, subset, status, badfn)
+        super(fullmatchctx, self).__init__(ctx, status, badfn)
     def switch(self, ctx, status=None):
         return fullmatchctx(ctx, status, self._badfn)
 
@@ -646,15 +640,6 @@  def _intree(funcs, tree):
                 return True
     return False
 
-def _buildsubset(ctx, status):
-    if status:
-        subset = []
-        for c in status:
-            subset.extend(c)
-        return subset
-    else:
-        return list(ctx.walk(ctx.match([])))
-
 def match(ctx, expr, badfn=None):
     """Create a matcher for a single fileset expression"""
     tree = parse(expr)