checkheads: gather the postprocessing with other obsolescence specific code
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 29 May 2017 05:45:59 +0200
changeset 32705 70a020daf0b9
parent 32704 1270b00a385d
child 32706 993f58db2045
checkheads: gather the postprocessing with other obsolescence specific code We extract this function from the loop and gather it with the rest of the obsolescence specific code. That will help to clarify the move of the whole logic inside the "heads summary" computation.
mercurial/discovery.py
--- a/mercurial/discovery.py	Tue Jun 06 14:38:59 2017 -0700
+++ b/mercurial/discovery.py	Mon May 29 05:45:59 2017 +0200
@@ -331,13 +331,17 @@
     # If there are more heads after the push than before, a suitable
     # error message, depending on unsynced status, is displayed.
     errormsg = None
-    # If there is no obsstore, allfuturecommon won't be used, so no
-    # need to compute it.
+    # 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
@@ -347,9 +351,6 @@
             oldhs = set(remoteheads)
         oldhs.update(unsyncedheads)
         dhs = None # delta heads, the new heads on branch
-        if repo.obsstore:
-            result = _postprocessobsolete(pushop, allfuturecommon, newheads)
-            newheads = sorted(result[0])
         newhs = set(newheads)
         newhs.update(unsyncedheads)
         if unsyncedheads: