[PATCH 27 of 36] context: move match from changectx

Sean Farley sean.michael.farley at gmail.com
Wed Aug 7 13:13:27 CDT 2013


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1375746060 18000
#      Mon Aug 05 18:41:00 2013 -0500
# Node ID fecd37a97e40d7cbef3a5621051d82962eeab434
# Parent  149a38e324edccb649d67d463ec13961a9814f4e
context: move match from changectx

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -120,10 +120,16 @@
             return ''
 
     def sub(self, path):
         return subrepo.subrepo(self, path)
 
+    def match(self, pats=[], include=None, exclude=None, default='glob'):
+        r = self._repo
+        return matchmod.match(r.root, r.getcwd(), pats,
+                              include, exclude, default,
+                              auditor=r.auditor, ctx=self)
+
 class changectx(context):
     """A changecontext object makes access to data related to a particular
     changeset convenient. It represents a read-only context already presnt in
     the repo."""
     def __init__(self, repo, changeid=''):
@@ -375,16 +381,10 @@
                 # specified pattern is a directory
                 continue
             if match.bad(fn, _('no such file in rev %s') % self) and match(fn):
                 yield fn
 
-    def match(self, pats=[], include=None, exclude=None, default='glob'):
-        r = self._repo
-        return matchmod.match(r.root, r.getcwd(), pats,
-                              include, exclude, default,
-                              auditor=r.auditor, ctx=self)
-
     def diff(self, ctx2=None, match=None, **opts):
         """Returns a diff generator for the given contexts and matcher"""
         if ctx2 is None:
             ctx2 = self.p1()
         if ctx2 is not None and not isinstance(ctx2, changectx):


More information about the Mercurial-devel mailing list