[PATCH 3 of 3] extensions: add unwrapfunction to undo wrapfunction

Jun Wu quark at fb.com
Wed Jul 6 11:47:13 EDT 2016


Sorry for the late reply. This thread gets broken while I was debugging my
email client. I will send a V2.

Excerpts from Yuya Nishihara's message of 2016-07-03 17:11:00 +0900:
> "unwrap" sounds different to me from what this function does. I expected it
> would do unwrapfunction(container, funcname) -> last_wrapper. Any idea?

Good idea. I think it makes sense to let the "wrapper" argument default
to None, and in that case, the last wrapper will be removed.

I will also add a "return".

> I noticed we can't apply unwrapfunction() to wrapped commands even though
> they have _origfunc and _unboundwrapper attributes. But that should be okay
> because wrapcommand() has distinct interface from wrapfunction().

Yes it's because unwrapfunction uses wrapfunction. I think it's fine for
now. If we want to do clean-ups, we can try to share code between
wrapfunciont and wrapcommand, and maybe store extra metadata as attributes
of the wrapped method.


More information about the Mercurial-devel mailing list