Mercurial > evolve
changeset 3204:a342c454ccf3 stable
pusoperation: wrap pushoperation __init__ directly
This is how remote names does it. Using the same method should helps with
compatibility when mixing the two extensions.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 24 Nov 2017 22:36:57 +0100 |
parents | 34d5c97a3dee |
children | 0b85da2e8e2a c9e7b8db9900 |
files | hgext3rd/topic/flow.py |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/topic/flow.py Thu Nov 23 00:29:52 2017 +0100 +++ b/hgext3rd/topic/flow.py Fri Nov 24 22:36:57 2017 +0100 @@ -41,11 +41,10 @@ newargs['opargs']['publish'] = True return orig(repo, remote, *args, **newargs) -def extendpushoperation(orig, *args, **kwargs): +def extendpushoperation(orig, self, *args, **kwargs): publish = kwargs.pop('publish', False) - op = orig(*args, **kwargs) - op.publish = publish - return op + orig(self, *args, **kwargs) + self.publish = publish def wrapphasediscovery(orig, pushop): orig(pushop) @@ -64,6 +63,7 @@ entry = extensions.wrapcommand(commands.table, 'push', wrappush) entry[1].append(('', 'publish', False, _('push the changeset as public'))) - extensions.wrapfunction(exchange, 'pushoperation', extendpushoperation) + extensions.wrapfunction(exchange.pushoperation, '__init__', + extendpushoperation) extensions.wrapfunction(exchange, '_pushdiscoveryphase', wrapphasediscovery) exchange.pushdiscoverymapping['phase'] = exchange._pushdiscoveryphase