[PATCH 2 of 4] narrowmatcher: propagate bad method

Martin Geisler mg at lazybytes.net
Tue Sep 7 10:45:55 CDT 2010


# HG changeset patch
# User Martin Geisler <mg at lazybytes.net>
# Date 1283871682 -7200
# Node ID 95e4071b9ba50f15952117001b19917f0eeff664
# Parent  5436a29c2668316a5bf1da58dbbd2bca8705cb99
narrowmatcher: propagate bad method

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -131,6 +131,11 @@
     True
     >>> m2.rel('b.txt')
     'b.txt'
+    >>> def bad(f, msg):
+    ...     print "%s: %s" % (f, msg)
+    >>> m1.bad = bad
+    >>> m2.bad('x.txt', 'No such file')
+    sub/x.txt: No such file
     """
 
     def __init__(self, path, matcher):
@@ -145,6 +150,9 @@
         self.matchfn = lambda fn: matcher.matchfn(self._path + "/" + fn)
         self._fmap = set(self._files)
 
+    def bad(self, f, msg):
+        self._matcher.bad(self._path + "/" + f, msg)
+
 def patkind(pat):
     return _patsplit(pat, None)[0]
 


More information about the Mercurial-devel mailing list