Mercurial > evolve
changeset 2558:65cf338258d2
fix: fix _headssummary api
_headssummary now takes directly the pushop, update the topic extension
wrapping to fix the API.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Wed, 14 Jun 2017 13:56:40 +0200 |
parents | d5b97b5dec5b |
children | 08fe25f249fc |
files | hgext3rd/topic/discovery.py |
diffstat | 1 files changed, 16 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/topic/discovery.py Thu Jun 08 20:52:40 2017 +0100 +++ b/hgext3rd/topic/discovery.py Wed Jun 14 13:56:40 2017 +0200 @@ -15,11 +15,24 @@ from . import topicmap -def _headssummary(orig, repo, remote, outgoing): +def _headssummary(orig, *args): + # In mercurial < 4.2, we receive repo, remote and outgoing as arguments + if len(args) == 3: + repo, remote, outgoing = args + + # In mercurial > 4.3, we receive the pushop as arguments + elif len(args) == 1: + 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)) + publishing = ('phases' not in remote.listkeys('namespaces') or bool(remote.listkeys('phases').get('publishing', False))) if publishing or not remote.capable('topics'): - return orig(repo, remote, outgoing) + return orig(pushop) oldrepo = repo.__class__ oldbranchcache = branchmap.branchcache oldfilename = branchmap._filename @@ -42,7 +55,7 @@ repo.__class__ = repocls branchmap.branchcache = topicmap.topiccache branchmap._filename = topicmap._filename - summary = orig(repo, remote, outgoing) + summary = orig(*args) for key, value in summary.iteritems(): if ':' in key: # This is a topic if value[0] is None and value[1]: