hgext3rd/topic/flow.py
branchmercurial-4.8
changeset 4356 a71f2271ed76
parent 4263 35130e428ebd
child 4647 228caeb8b7af
--- a/hgext3rd/topic/flow.py	Tue Jan 22 10:43:44 2019 -0500
+++ b/hgext3rd/topic/flow.py	Tue Jan 22 10:46:02 2019 -0500
@@ -7,7 +7,6 @@
     extensions,
     node,
     phases,
-    util,
 )
 
 from mercurial.i18n import _
@@ -75,9 +74,6 @@
 def wrapphasediscovery(orig, pushop):
     orig(pushop)
     if getattr(pushop, 'publish', False):
-        if not util.safehasattr(pushop, 'remotephases'):
-            msg = _('--publish flag only supported from Mercurial 4.4 and higher')
-            raise error.Abort(msg)
         if not pushop.remotephases.publishing:
             unfi = pushop.repo.unfiltered()
             droots = pushop.remotephases.draftroots
@@ -87,8 +83,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)