# HG changeset patch # User Matt Harbison # Date 1433468279 14400 # Node ID a592a6a6f4fe685c76b11bb0c08841b72fdc256d # Parent 5984dd42e140798065221be714f6c675c421a939 context: replace match.bad() monkey patching with match.badmatch() No known issues with the previous code since it restored the original method, but this is cleaner. diff -r 5984dd42e140 -r a592a6a6f4fe mercurial/context.py --- a/mercurial/context.py Thu Jun 04 21:25:07 2015 -0400 +++ b/mercurial/context.py Thu Jun 04 21:37:59 2015 -0400 @@ -9,7 +9,7 @@ from i18n import _ import mdiff, error, util, scmutil, subrepo, patch, encoding, phases import match as matchmod -import copy, os, errno, stat +import os, errno, stat import obsolete as obsmod import repoview import fileset @@ -595,19 +595,17 @@ def walk(self, match): '''Generates matching file names.''' - # Override match.bad method to have message with nodeid - match = copy.copy(match) - oldbad = match.bad + # Wrap match.bad method to have message with nodeid def bad(fn, msg): # The manifest doesn't know about subrepos, so don't complain about # paths into valid subrepos. if any(fn == s or fn.startswith(s + '/') for s in self.substate): return - oldbad(fn, _('no such file in rev %s') % self) - match.bad = bad + match.bad(fn, _('no such file in rev %s') % self) - return self._manifest.walk(match) + m = matchmod.badmatch(match, bad) + return self._manifest.walk(m) def matches(self, match): return self.walk(match)