log: speed up hg log <file|folder>
authorLaurent Charignon <lcharignon@fb.com>
Fri, 18 Dec 2015 12:54:45 -0800
changeset 27440 ff305ab2e0d7
parent 27439 ed003859f1d8
child 27442 f67c6d8cc606
log: speed up hg log <file|folder> This patch makes hg log <file|folder> faster by using changelog.readfiles instead of changelog.read. On our large repos for hg log <file|folder> -l5 operations that were taking: - ~8s I see a 25% improvement - ~15s, I see a 35% improvement For recently modified folder/file, the difference is negligible as we don't have to consider many revisions.
mercurial/revset.py
--- a/mercurial/revset.py	Fri Dec 18 13:45:55 2015 -0800
+++ b/mercurial/revset.py	Fri Dec 18 12:54:45 2015 -0800
@@ -1166,13 +1166,13 @@
 
     # This directly read the changelog data as creating changectx for all
     # revisions is quite expensive.
-    getchangeset = repo.changelog.read
+    getfiles = repo.changelog.readfiles
     wdirrev = node.wdirrev
     def matches(x):
         if x == wdirrev:
             files = repo[x].files()
         else:
-            files = getchangeset(x)[3]
+            files = getfiles(x)
         for f in files:
             if m(f):
                 return True