[PATCH 1 of 2] repoview: allow methods on the proxy class to be replaced

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Dec 10 18:00:09 CST 2014



On 12/08/2014 06:31 PM, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1417967576 18000
> #      Sun Dec 07 10:52:56 2014 -0500
> # Node ID 299fc395d9c4f633a07ef08187f46151ca0ab298
> # 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().

This seems a bit too fragile to me. This mean that setting the method on 
a filtered version will have no effect on other filtered version.
The current approach will no doubt works in your case but I wonder if we 
can find other approach that would prevent other people to get bitten in 
the future.

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list