# HG changeset patch # User Anton Shestakov # Date 1699243091 10800 # Node ID 995c6163e97b100acae4821c4015c6ecd6890880 # Parent 7169272b1b9084f9e0a8e1d04475c4a837979913 topic: drop compatibility for hg push with --publish flag in hg 4.8 diff -r 7169272b1b90 -r 995c6163e97b hgext3rd/topic/__init__.py --- 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'))) diff -r 7169272b1b90 -r 995c6163e97b hgext3rd/topic/flow.py --- 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