changeset 6641:995c6163e97b

topic: drop compatibility for hg push with --publish flag in hg 4.8
author Anton Shestakov <av6@dwimlabs.net>
date Mon, 06 Nov 2023 00:58:11 -0300
parents 7169272b1b90
children 196babdbb593
files hgext3rd/topic/__init__.py hgext3rd/topic/flow.py
diffstat 2 files changed, 0 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Thu Oct 26 14:50:20 2023 -0300
+++ b/hgext3rd/topic/__init__.py	Mon Nov 06 00:58:11 2023 -0300
@@ -524,8 +524,6 @@
 
     extensions.afterloaded(b'rebase', _fixrebase)
 
-    flow.installpushflag(ui)
-
     entry = extensions.wrapcommand(commands.table, b'commit', commitwrap)
     entry[1].append((b't', b'topic', b'',
                      _(b"use specified topic"), _(b'TOPIC')))
--- a/hgext3rd/topic/flow.py	Thu Oct 26 14:50:20 2023 -0300
+++ b/hgext3rd/topic/flow.py	Mon Nov 06 00:58:11 2023 -0300
@@ -1,10 +1,8 @@
 from __future__ import absolute_import
 
 from mercurial import (
-    commands,
     error,
     exchange,
-    extensions,
     node,
     phases,
     util,
@@ -82,43 +80,6 @@
             msg += b' and %d others' % (len(published) - 1)
         raise error.Abort(msg)
 
-def wrappush(orig, repo, remote, *args, **kwargs):
-    """interpret the --publish flag and pass it to the push operation"""
-    newargs = kwargs.copy()
-    if kwargs.pop('publish', False):
-        opargs = kwargs.get('opargs')
-        if opargs is None:
-            opargs = {}
-        newargs[r'opargs'] = opargs.copy()
-        newargs[r'opargs'][b'publish'] = True
-    return orig(repo, remote, *args, **newargs)
-
-def extendpushoperation(orig, self, *args, **kwargs):
-    publish = kwargs.pop('publish', False)
-    orig(self, *args, **kwargs)
-    self.publish = publish
-
-def wrapphasediscovery(orig, pushop):
-    orig(pushop)
-    if getattr(pushop, 'publish', False):
-        if not pushop.remotephases.publishing:
-            unfi = pushop.repo.unfiltered()
-            droots = pushop.remotephases.draftroots
-            revset = b'%ln and (not public() or %ln::)'
-            future = list(unfi.set(revset, pushop.futureheads, droots))
-            pushop.outdatedphases = future
-
-def installpushflag(ui):
-    entry = extensions.wrapcommand(commands.table, b'push', wrappush)
-    if not any(opt for opt in entry[1] if opt[1] == b'publish'):
-        # hg <= 4.8 (9b8d1ad851f8)
-        entry[1].append((b'', b'publish', False,
-                         _(b'push the changeset as public')))
-    extensions.wrapfunction(exchange.pushoperation, '__init__',
-                            extendpushoperation)
-    extensions.wrapfunction(exchange, '_pushdiscoveryphase', wrapphasediscovery)
-    exchange.pushdiscoverymapping[b'phase'] = exchange._pushdiscoveryphase
-
 def replacecheckpublish(orig, pushop):
     listkeys = exchange.listkeys
     repo = pushop.repo