comparison hgext3rd/topic/discovery.py @ 6667:31e157a5cfe2

cleanup: remove unnecessary remotebranchmap checks This is some leftovers from 35130e428ebd where remotebranchmap wasn't always created.
author Manuel Jacob <me@manueljacob.de>
date Thu, 01 Feb 2024 23:58:40 +0100
parents ff2ba083f8b4
children a7d94f235488
comparison
equal deleted inserted replaced
6659:aa1cea32ae90 6667:31e157a5cfe2
81 def _headssummary(orig, pushop, *args, **kwargs): 81 def _headssummary(orig, pushop, *args, **kwargs):
82 repo = pushop.repo.unfiltered() 82 repo = pushop.repo.unfiltered()
83 remote = pushop.remote 83 remote = pushop.remote
84 84
85 publishedset = () 85 publishedset = ()
86 remotebranchmap = None
87 if remote.capable(b'topics-namespaces'): 86 if remote.capable(b'topics-namespaces'):
88 origremotebranchmap = remote.branchmaptns 87 origremotebranchmap = remote.branchmaptns
89 else: 88 else:
90 origremotebranchmap = remote.branchmap 89 origremotebranchmap = remote.branchmap
91 publishednode = [c.node() for c in pushop.outdatedphases] 90 publishednode = [c.node() for c in pushop.outdatedphases]
135 heads.sort() 134 heads.sort()
136 return result 135 return result
137 136
138 with ctxoverride, configoverride: 137 with ctxoverride, configoverride:
139 try: 138 try:
140 if remotebranchmap is not None: 139 remote.branchmap = remotebranchmap
141 remote.branchmap = remotebranchmap
142 unxx = repo.filtered(b'unfiltered-topic') 140 unxx = repo.filtered(b'unfiltered-topic')
143 repo.unfiltered = lambda: unxx 141 repo.unfiltered = lambda: unxx
144 pushop.repo = repo 142 pushop.repo = repo
145 summary = orig(pushop) 143 summary = orig(pushop)
146 for key, value in summary.items(): 144 for key, value in summary.items():
150 summary[key] = ([value[1][0]], ) + value[1:] 148 summary[key] = ([value[1][0]], ) + value[1:]
151 return summary 149 return summary
152 finally: 150 finally:
153 if r'unfiltered' in vars(repo): 151 if r'unfiltered' in vars(repo):
154 del repo.unfiltered 152 del repo.unfiltered
155 if remotebranchmap is not None: 153 remote.branchmap = origremotebranchmap
156 remote.branchmap = origremotebranchmap
157 154
158 def wireprotobranchmap(orig, repo, proto): 155 def wireprotobranchmap(orig, repo, proto):
159 if not common.hastopicext(repo): 156 if not common.hastopicext(repo):
160 return orig(repo, proto) 157 return orig(repo, proto)
161 unfi = repo.unfiltered() 158 unfi = repo.unfiltered()