changeset 51609:5b99b64328f2

phases: use revision number in `_pushdiscoveryphase` We now reach our target checkpoint in terms of rev-num conversion. The `_pushdiscoveryphase` function is now performing graph computation based on revision number only. Avoiding repeated conversion from node-id to rev-num. See previous changeset updated `new_heads` for rationnal. Again, time saved in the 100 milliseconds order of magnitude for the mozilla-try benchmark I have been using. However, wow that the logic is done using revision number, we can look into having better logic in the next changesets, which will provide a much bigger speedup.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 05 Apr 2024 14:13:47 +0200
parents 22cc679a7312
children c11d21faa73c
files mercurial/exchange.py
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/exchange.py	Fri Apr 05 14:11:02 2024 +0200
+++ b/mercurial/exchange.py	Fri Apr 05 14:13:47 2024 +0200
@@ -645,6 +645,7 @@
         return
 
     fallbackheads_rev = [to_rev(n) for n in pushop.fallbackheads]
+    futureheads_rev = [to_rev(n) for n in pushop.futureheads]
 
     pushop.remotephases = phases.RemotePhasesSummary(
         pushop.repo,
@@ -656,15 +657,15 @@
     extracond = b''
     if not pushop.remotephases.publishing:
         extracond = b' and public()'
-    revset = b'heads((%%ld::%%ln) %s)' % extracond
+    revset = b'heads((%%ld::%%ld) %s)' % extracond
     # Get the list of all revs draft on remote by public here.
     # XXX Beware that revset break if droots is not strictly
     # XXX root we may want to ensure it is but it is costly
-    fallback = list(unfi.set(revset, droots, pushop.fallbackheads))
+    fallback = list(unfi.set(revset, droots, fallbackheads_rev))
     if not pushop.remotephases.publishing and pushop.publish:
         future = list(
             unfi.set(
-                b'%ln and (not public() or %ld::)', pushop.futureheads, droots
+                b'%ld and (not public() or %ld::)', futureheads_rev, droots
             )
         )
     elif not outgoing.missing:
@@ -674,11 +675,10 @@
         #
         # should not be necessary for publishing server, but because of an
         # issue fixed in xxxxx we have to do it anyway.
-        fdroots = list(
-            unfi.set(b'roots(%ln  + %ld::)', outgoing.missing, droots)
-        )
+        missing_rev = [to_rev(n) for n in outgoing.missing]
+        fdroots = list(unfi.set(b'roots(%ld  + %ld::)', missing_rev, droots))
         fdroots = [f.rev() for f in fdroots]
-        future = list(unfi.set(revset, fdroots, pushop.futureheads))
+        future = list(unfi.set(revset, fdroots, futureheads_rev))
     pushop.outdatedphases = future
     pushop.fallbackoutdatedphases = fallback