fileset: move copy constructor of matchctx near __init__
authorYuya Nishihara <yuya@tcha.org>
Sun, 22 Jul 2018 19:43:57 +0900
changeset 38881 dec16c0cce50
parent 38880 80fd7371f2d8
child 38882 ff42ec7845e4
fileset: move copy constructor of matchctx near __init__
mercurial/fileset.py
--- a/mercurial/fileset.py	Sun Jul 22 11:20:48 2018 +0900
+++ b/mercurial/fileset.py	Sun Jul 22 19:43:57 2018 +0900
@@ -462,6 +462,9 @@
         self._badfn = badfn
         self._status = None
 
+    def switch(self, basectx, ctx):
+        return matchctx(basectx, ctx, self._badfn)
+
     def withstatus(self, keys):
         """Create matchctx which has precomputed status specified by the keys"""
         mctx = matchctx(self._basectx, self.ctx, self._badfn)
@@ -528,9 +531,6 @@
         return matchmod.nevermatcher(repo.root, repo.getcwd(),
                                      badfn=self._badfn)
 
-    def switch(self, basectx, ctx):
-        return matchctx(basectx, ctx, self._badfn)
-
 def match(ctx, expr, badfn=None):
     """Create a matcher for a single fileset expression"""
     tree = filesetlang.parse(expr)