context: move walk() and match() overrides from committablectx to workingctx
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 10 May 2019 21:53:41 -0700
changeset 42293 4fbfc893e6b9
parent 42292 491855ea9d62
child 42294 c51b103220c7
context: move walk() and match() overrides from committablectx to workingctx Same reasoning as previous commit: these functions update the dirstate. Differential Revision: https://phab.mercurial-scm.org/D6363
mercurial/context.py
--- a/mercurial/context.py	Fri May 10 21:35:30 2019 -0700
+++ b/mercurial/context.py	Fri May 10 21:53:41 2019 -0700
@@ -1209,17 +1209,6 @@
         """return the "best" ancestor context of self and c2"""
         return self._parents[0].ancestor(c2) # punt on two parents for now
 
-    def walk(self, match):
-        '''Generates matching file names.'''
-        return sorted(self._repo.dirstate.walk(self._repo.narrowmatch(match),
-                                               subrepos=sorted(self.substate),
-                                               unknown=True, ignored=False))
-
-    def matches(self, match):
-        match = self._repo.narrowmatch(match)
-        ds = self._repo.dirstate
-        return sorted(f for f in ds.matches(match) if ds[f] != 'r')
-
     def ancestors(self):
         for p in self._parents:
             yield p
@@ -1656,6 +1645,17 @@
             match.bad = bad
         return match
 
+    def walk(self, match):
+        '''Generates matching file names.'''
+        return sorted(self._repo.dirstate.walk(self._repo.narrowmatch(match),
+                                               subrepos=sorted(self.substate),
+                                               unknown=True, ignored=False))
+
+    def matches(self, match):
+        match = self._repo.narrowmatch(match)
+        ds = self._repo.dirstate
+        return sorted(f for f in ds.matches(match) if ds[f] != 'r')
+
     def markcommitted(self, node):
         super(workingctx, self).markcommitted(node)