Mercurial > evolve
changeset 3186:9d9ff55d1bb1 stable
compat: fix comp ability of the new phase logic for Mercurial < 4.4
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 14 Nov 2017 23:11:00 +0100 |
parents | 0c64d0242ac2 |
children | 68aeeb4d4b8f f4ba7d662c4c |
files | hgext3rd/topic/discovery.py |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/topic/discovery.py Thu Nov 02 19:08:36 2017 +0100 +++ b/hgext3rd/topic/discovery.py Tue Nov 14 23:11:00 2017 +0100 @@ -16,6 +16,7 @@ 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 @@ -33,13 +34,14 @@ publishing = ('phases' not in remote.listkeys('namespaces') or bool(remote.listkeys('phases').get('publishing', False))) if ((publishing or not remote.capable('topics')) - and (pushoparg and not pushop.publish)): + and not getattr(pushop, 'publish', False)): return orig(*args) publishedset = () remotebranchmap = None origremotebranchmap = remote.branchmap - if pushoparg: # < hg-4.4 do not have a --publish flag anyway + # < hg-4.4 do not have a --publish flag anyway + if pushoparg and util.safehasattr(pushop, 'remotephases'): publishednode = [c.node() for c in pushop.outdatedphases] publishedset = repo.revs('ancestors(%ln + %ln)', publishednode, @@ -103,7 +105,8 @@ oldrepocls = repo.__class__ try: repo.__class__ = repocls - remote.branchmap = remotebranchmap + if remotebranchmap is not None: + remote.branchmap = remotebranchmap unxx = repo.filtered('unfiltered-topic') repo.unfiltered = lambda: unxx if pushoparg: @@ -120,7 +123,8 @@ if 'unfiltered' in vars(repo): del repo.unfiltered repo.__class__ = oldrepocls - remote.branchmap = origremotebranchmap + if remotebranchmap is not None: + remote.branchmap = origremotebranchmap def wireprotobranchmap(orig, repo, proto): oldrepo = repo.__class__