checkheads: perform obsolescence post processing directly in _headssummary
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 29 May 2017 05:47:27 +0200
changeset 32707 32c8f98aebf4
parent 32706 993f58db2045
child 32708 90cb4ec8df64
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.
mercurial/discovery.py
--- a/mercurial/discovery.py	Mon May 29 10:56:00 2017 +0200
+++ b/mercurial/discovery.py	Mon May 29 05:47:27 2017 +0200
@@ -242,6 +242,17 @@
         for l in items:
             if l is not None:
                 l.sort()
+    # If there are no obsstore, no post processing are needed.
+    if repo.obsstore:
+        allmissing = set(outgoing.missing)
+        cctx = repo.set('%ld', outgoing.common)
+        allfuturecommon = set(c.node() for c in cctx)
+        allfuturecommon.update(allmissing)
+        for branch, heads in sorted(headssum.iteritems()):
+            remoteheads, newheads, unsyncedheads = heads
+            result = _postprocessobsolete(pushop, allfuturecommon, newheads)
+            newheads = sorted(result[0])
+            headssum[branch] = (remoteheads, newheads, unsyncedheads)
     return headssum
 
 def _oldheadssummary(repo, remoteheads, outgoing, inc=False):
@@ -334,17 +345,6 @@
     # If there are more heads after the push than before, a suitable
     # error message, depending on unsynced status, is displayed.
     errormsg = None
-    # If there are no obsstore, no post-processing are needed.
-    if repo.obsstore:
-        allmissing = set(outgoing.missing)
-        cctx = repo.set('%ld', outgoing.common)
-        allfuturecommon = set(c.node() for c in cctx)
-        allfuturecommon.update(allmissing)
-        for branch, heads in sorted(headssum.iteritems()):
-            remoteheads, newheads, unsyncedheads = heads
-            result = _postprocessobsolete(pushop, allfuturecommon, newheads)
-            newheads = sorted(result[0])
-            headssum[branch] = (remoteheads, newheads, unsyncedheads)
     for branch, heads in sorted(headssum.iteritems()):
         remoteheads, newheads, unsyncedheads = heads
         # add unsynced data