# HG changeset patch # User Pierre-Yves David # Date 1511559417 -3600 # Node ID a342c454ccf3c69732eae122ccdda19e0fecc4b7 # Parent 34d5c97a3deedb0f73a7d82c1599b971060e4b26 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. diff -r 34d5c97a3dee -r a342c454ccf3 hgext3rd/topic/flow.py --- 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