Mercurial > hg-stable
comparison mercurial/discovery.py @ 32727:32c8f98aebf4
checkheads: perform obsolescence post processing directly in _headssummary
The goal is to have the function directly return something meaningful and
useful for the whole pull.
Note: we skip adding post-processing in '_oldheadssummary' because if a client
is too old for branchmap it will be too old for obsolescence too.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 29 May 2017 05:47:27 +0200 |
parents | 993f58db2045 |
children | 90cb4ec8df64 |
comparison
equal
deleted
inserted
replaced
32726:993f58db2045 | 32727:32c8f98aebf4 |
---|---|
240 headssum[branch][1][:] = newheads | 240 headssum[branch][1][:] = newheads |
241 for branch, items in headssum.iteritems(): | 241 for branch, items in headssum.iteritems(): |
242 for l in items: | 242 for l in items: |
243 if l is not None: | 243 if l is not None: |
244 l.sort() | 244 l.sort() |
245 # If there are no obsstore, no post processing are needed. | |
246 if repo.obsstore: | |
247 allmissing = set(outgoing.missing) | |
248 cctx = repo.set('%ld', outgoing.common) | |
249 allfuturecommon = set(c.node() for c in cctx) | |
250 allfuturecommon.update(allmissing) | |
251 for branch, heads in sorted(headssum.iteritems()): | |
252 remoteheads, newheads, unsyncedheads = heads | |
253 result = _postprocessobsolete(pushop, allfuturecommon, newheads) | |
254 newheads = sorted(result[0]) | |
255 headssum[branch] = (remoteheads, newheads, unsyncedheads) | |
245 return headssum | 256 return headssum |
246 | 257 |
247 def _oldheadssummary(repo, remoteheads, outgoing, inc=False): | 258 def _oldheadssummary(repo, remoteheads, outgoing, inc=False): |
248 """Compute branchmapsummary for repo without branchmap support""" | 259 """Compute branchmapsummary for repo without branchmap support""" |
249 | 260 |
332 | 343 |
333 # 3. Check for new heads. | 344 # 3. Check for new heads. |
334 # If there are more heads after the push than before, a suitable | 345 # If there are more heads after the push than before, a suitable |
335 # error message, depending on unsynced status, is displayed. | 346 # error message, depending on unsynced status, is displayed. |
336 errormsg = None | 347 errormsg = None |
337 # If there are no obsstore, no post-processing are needed. | |
338 if repo.obsstore: | |
339 allmissing = set(outgoing.missing) | |
340 cctx = repo.set('%ld', outgoing.common) | |
341 allfuturecommon = set(c.node() for c in cctx) | |
342 allfuturecommon.update(allmissing) | |
343 for branch, heads in sorted(headssum.iteritems()): | |
344 remoteheads, newheads, unsyncedheads = heads | |
345 result = _postprocessobsolete(pushop, allfuturecommon, newheads) | |
346 newheads = sorted(result[0]) | |
347 headssum[branch] = (remoteheads, newheads, unsyncedheads) | |
348 for branch, heads in sorted(headssum.iteritems()): | 348 for branch, heads in sorted(headssum.iteritems()): |
349 remoteheads, newheads, unsyncedheads = heads | 349 remoteheads, newheads, unsyncedheads = heads |
350 # add unsynced data | 350 # add unsynced data |
351 if remoteheads is None: | 351 if remoteheads is None: |
352 oldhs = set() | 352 oldhs = set() |