narrowmatcher: propagate bad method
The full path is propagated to the original match object since this is
often used directly for printing an error to the user.
--- a/mercurial/match.py Mon Sep 13 13:08:18 2010 +0200
+++ b/mercurial/match.py Mon Sep 13 13:09:09 2010 +0200
@@ -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]