topic: only add --publish flag to push if it's not already there
authorAnton Shestakov <av6@dwimlabs.net>
Sun, 04 Nov 2018 22:06:23 +0800
changeset 4245 419801742d08
parent 4244 0e266166457f
child 4246 2d9902f0ff17
topic: only add --publish flag to push if it's not already there
hgext3rd/topic/flow.py
--- a/hgext3rd/topic/flow.py	Mon Nov 05 16:04:01 2018 +0800
+++ b/hgext3rd/topic/flow.py	Sun Nov 04 22:06:23 2018 +0800
@@ -87,8 +87,9 @@
 
 def installpushflag(ui):
     entry = extensions.wrapcommand(commands.table, 'push', wrappush)
-    entry[1].append(('', 'publish', False,
-                    _('push the changeset as public')))
+    if not any(opt for opt in entry[1] if opt[1] == 'publish'): # hg <= 4.9
+        entry[1].append(('', 'publish', False,
+                         _('push the changeset as public')))
     extensions.wrapfunction(exchange.pushoperation, '__init__',
                             extendpushoperation)
     extensions.wrapfunction(exchange, '_pushdiscoveryphase', wrapphasediscovery)