Patchwork [3,of,6] checkheads: perform obsolescence post processing directly in _headssummary

login
register
mail settings
Submitter Pierre-Yves David
Date June 4, 2017, 2:49 p.m.
Message ID <0be71c66f99550d0abc1.1496587771@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/21170/
State Accepted
Headers show

Comments

Pierre-Yves David - June 4, 2017, 2:49 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1496029647 -7200
#      Mon May 29 05:47:27 2017 +0200
# Node ID 0be71c66f99550d0abc18fceaa86e0ac018bd382
# Parent  60a6a3a24864486abf07736d7c591e73a6e7e012
# EXP-Topic pushrace
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 0be71c66f995
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.o

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.
Yuya Nishihara - June 7, 2017, 1:35 p.m.
On Sun, 04 Jun 2017 15:49:31 +0100, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@octobus.net>
> # Date 1496029647 -7200
> #      Mon May 29 05:47:27 2017 +0200
> # Node ID 0be71c66f99550d0abc18fceaa86e0ac018bd382
> # Parent  60a6a3a24864486abf07736d7c591e73a6e7e012
> # EXP-Topic pushrace
> # Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
> #              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 0be71c66f995
> 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.o

I couldn't figure out what the last .o would mean, so did s/\.o$/./.

Patch

diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -242,6 +242,17 @@  def _headssummary(pushop):
         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 @@  def checkheads(pushop):
     # 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