[PATCH 2 of 3] perfphases: add a flag to also include file access time

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue May 23 10:04:22 EDT 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1495499261 -7200
#      Tue May 23 02:27:41 2017 +0200
# Node ID c79b8f2a95a35ce1b41325d003337c65bc5bffca
# Parent  e7b7317363359a4bb15b5713ff034c6fd2008339
# EXP-Topic perf
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r c79b8f2a95a3
perfphases: add a flag to also include file access time

The flag purges all phases data so we'll have to read the file from disk again.

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -581,12 +581,25 @@ def perfpathcopies(ui, repo, rev1, rev2,
     timer(d)
     fm.end()
 
- at command('perfphases', [], "")
+def _clearphasecache(repo):
+    unfi = repo.unfiltered()
+    if '_phasecache' in vars(unfi):
+        del repo._phasecache
+        del repo._filecache['_phasecache']
+
+ at command('perfphases',
+         [('', 'full', False, 'include file reading time too'),
+         ], "")
 def perfphases(ui, repo, **opts):
     """benchmark phasesets computation"""
     timer, fm = gettimer(ui, opts)
-    phases = repo._phasecache
+    _phases = repo._phasecache
+    full = opts.get('full')
     def d():
+        phases = _phases
+        if full:
+            _clearphasecache(repo)
+            phases = repo._phasecache
         phases.invalidate()
         phases.loadphaserevs(repo)
     timer(d)


More information about the Mercurial-devel mailing list