Patchwork [27,of,36] context: move match from changectx

login
register
mail settings
Submitter Sean Farley
Date Aug. 7, 2013, 6:13 p.m.
Message ID <fecd37a97e40d7cbef3a.1375899207@laptop.local>
Download mbox | patch
Permalink /patch/2044/
State Superseded
Commit 7cb90c58d91afc48844dbeae0b9905832e3db3df
Delegated to: Augie Fackler
Headers show

Comments

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

Patch

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):