Patchwork [6,of,7] fileset: move copy constructor of matchctx near __init__

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 5, 2018, 2:31 p.m.
Message ID <e8bfa8f38e3bf8739f6e.1533479486@mimosa>
Download mbox | patch
Permalink /patch/33278/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 5, 2018, 2:31 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1532256237 -32400
#      Sun Jul 22 19:43:57 2018 +0900
# Node ID e8bfa8f38e3bf8739f6e1bbe8fe742cf0e1fe7f5
# Parent  734e80c5942b88ff437e14f16a4eaa051fbb1e9b
fileset: move copy constructor of matchctx near __init__

Patch

diff --git a/mercurial/fileset.py b/mercurial/fileset.py
--- a/mercurial/fileset.py
+++ b/mercurial/fileset.py
@@ -462,6 +462,9 @@  class matchctx(object):
         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 @@  class matchctx(object):
         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)