phases: use a more generic way to trigger a phases computation for perf
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 22 Feb 2024 10:56:05 +0100
changeset 51413 8fc92193a2cf
parent 51412 89b638afeb07
child 51414 630d5283ee82
phases: use a more generic way to trigger a phases computation for perf Querying the tip most revision will require the cache to warm the same as calling the dedicated method. This avoid using a method that is mostly meant for internal use and will be renamed in a coming changesets.
contrib/perf.py
tests/test-contrib-perf.t
--- a/contrib/perf.py	Wed Feb 21 12:01:09 2024 +0100
+++ b/contrib/perf.py	Thu Feb 22 10:56:05 2024 +0100
@@ -1719,6 +1719,7 @@
     timer, fm = gettimer(ui, opts)
     _phases = repo._phasecache
     full = opts.get(b'full')
+    tip_rev = repo.changelog.tiprev()
 
     def d():
         phases = _phases
@@ -1726,7 +1727,7 @@
             clearfilecache(repo, b'_phasecache')
             phases = repo._phasecache
         phases.invalidate()
-        phases.loadphaserevs(repo)
+        phases.phase(repo, tip_rev)
 
     timer(d)
     fm.end()
--- a/tests/test-contrib-perf.t	Wed Feb 21 12:01:09 2024 +0100
+++ b/tests/test-contrib-perf.t	Thu Feb 22 10:56:05 2024 +0100
@@ -293,6 +293,7 @@
   $ hg perfwalk
   $ hg perfparents
   $ hg perfdiscovery -q .
+  $ hg perf::phases
 
 Test run control
 ----------------