checkheads: simplify the code around obsolescence post-processing
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 29 May 2017 05:23:30 +0200
changeset 32675 fc9296c15112
parent 32674 7a7c4f3afb98
child 32676 4c3d9ee87382
checkheads: simplify the code around obsolescence post-processing The 'discardedheads' return become unused and the relationship between newheads and newhs can be clarified. Our next goal here is to be able to extract the _postprocessobsolete call outside of the loop. We keep returning the 'discardedheads' because we'll start using it again soon in this series.
mercurial/discovery.py
--- a/mercurial/discovery.py	Mon May 29 05:21:38 2017 +0200
+++ b/mercurial/discovery.py	Mon May 29 05:23:30 2017 +0200
@@ -347,13 +347,10 @@
             oldhs = set(remoteheads)
         oldhs.update(unsyncedheads)
         dhs = None # delta heads, the new heads on branch
-        if not repo.obsstore:
-            discardedheads = set()
-            newhs = set(newheads)
-        else:
-            newhs, discardedheads = _postprocessobsolete(pushop,
-                                                         allfuturecommon,
-                                                         newheads)
+        if repo.obsstore:
+            result = _postprocessobsolete(pushop, allfuturecommon, newheads)
+            newheads = sorted(result[0])
+        newhs = set(newheads)
         newhs.update(unsyncedheads)
         if unsyncedheads:
             if None in unsyncedheads: