Mercurial > evolve
diff hgext3rd/topic/discovery.py @ 3689:415c872d3308
topic: remove compatibility for older version in discovery wrapping
Support for 4.1 and 4.2 has been dropped.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 19 Apr 2018 14:14:34 +0200 |
parents | d725fe3e3989 |
children | ca7f02c9fa57 |
line wrap: on
line diff
--- a/hgext3rd/topic/discovery.py Thu Apr 19 14:01:24 2018 +0200 +++ b/hgext3rd/topic/discovery.py Thu Apr 19 14:14:34 2018 +0200 @@ -19,34 +19,22 @@ except ImportError: # <= hg-4.5 from mercurial import wireprotov1server as wireproto -def _headssummary(orig, *args): - # In mercurial < 4.2, we receive repo, remote and outgoing as arguments - pushop = None - if len(args) == 3: - pushoparg = False - repo, remote, outgoing = args - +def _headssummary(orig, pushop, *args, **kwargs): # In mercurial > 4.3, we receive the pushop as arguments - elif len(args) == 1: - pushoparg = True - pushop = args[0] - repo = pushop.repo.unfiltered() - remote = pushop.remote - else: - msg = 'topic-ext _headssummary() takes 1 or 3 arguments (%d given)' - raise TypeError(msg % len(args)) + repo = pushop.repo.unfiltered() + remote = pushop.remote publishing = ('phases' not in remote.listkeys('namespaces') or bool(remote.listkeys('phases').get('publishing', False))) if ((publishing or not remote.capable('topics')) and not getattr(pushop, 'publish', False)): - return orig(*args) + return orig(pushop, *args, **kwargs) publishedset = () remotebranchmap = None origremotebranchmap = remote.branchmap # < hg-4.4 do not have a --publish flag anyway - if pushoparg and util.safehasattr(pushop, 'remotephases'): + if util.safehasattr(pushop, 'remotephases'): publishednode = [c.node() for c in pushop.outdatedphases] publishedset = repo.revs('ancestors(%ln + %ln)', publishednode, @@ -114,11 +102,8 @@ remote.branchmap = remotebranchmap unxx = repo.filtered('unfiltered-topic') repo.unfiltered = lambda: unxx - if pushoparg: - pushop.repo = repo - summary = orig(pushop) - else: - summary = orig(repo, remote, outgoing) + pushop.repo = repo + summary = orig(pushop) for key, value in summary.iteritems(): if ':' in key: # This is a topic if value[0] is None and value[1]: