# HG changeset patch # User Matt Harbison # Date 1417967576 18000 # Node ID ced3ecfc2e57f3e178c48c1bd1c8358dadd9b95e # Parent b46876c94a935f570ac915ff3d345583c42989bd repoview: allow methods on the proxy class to be replaced It doesn't seem to be a common idiom for repo instances, but the status() method is replaced in largefiles' purge() override. Since __setattr__ is implemented in repoview to setattr() on the unfiltered repo, the replacement method wouldn't get called unless it was invoked with the unfiltered repo, because the filtered repo remains unchanged. Since this doesn't seem to be commonly used, I didn't bother to filter out methods that perhaps shouldn't be replaced, such as changelog(). diff -r b46876c94a93 -r ced3ecfc2e57 mercurial/repoview.py --- a/mercurial/repoview.py Wed Nov 26 23:23:33 2014 -0800 +++ b/mercurial/repoview.py Sun Dec 07 10:52:56 2014 -0500 @@ -6,6 +6,7 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. +import types import copy import error import phases @@ -310,6 +311,10 @@ return getattr(self._unfilteredrepo, attr) def __setattr__(self, attr, value): + # Allow method replacement on filtered repos, like status() in + # largefiles' purge override + if type(value) == types.FunctionType: + object.__setattr__(self, attr, value) return setattr(self._unfilteredrepo, attr, value) def __delattr__(self, attr):