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.
--- 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