# HG changeset patch # User Boris Feld # Date 1497441400 -7200 # Node ID 65cf338258d28e4f4a8a656c997f904d0753bd33 # Parent d5b97b5dec5b4024320d52b41522fc5efaa768ba fix: fix _headssummary api _headssummary now takes directly the pushop, update the topic extension wrapping to fix the API. diff -r d5b97b5dec5b -r 65cf338258d2 hgext3rd/topic/discovery.py --- 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]: