comparison mercurial/revset.py @ 27440:ff305ab2e0d7

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.
author Laurent Charignon <lcharignon@fb.com>
date Fri, 18 Dec 2015 12:54:45 -0800
parents 9e06e7fb037d
children c60a9c16ae25
comparison
equal deleted inserted replaced
27439:ed003859f1d8 27440:ff305ab2e0d7
1164 m = matchmod.match(repo.root, repo.getcwd(), pats, include=inc, 1164 m = matchmod.match(repo.root, repo.getcwd(), pats, include=inc,
1165 exclude=exc, ctx=repo[rev], default=default) 1165 exclude=exc, ctx=repo[rev], default=default)
1166 1166
1167 # This directly read the changelog data as creating changectx for all 1167 # This directly read the changelog data as creating changectx for all
1168 # revisions is quite expensive. 1168 # revisions is quite expensive.
1169 getchangeset = repo.changelog.read 1169 getfiles = repo.changelog.readfiles
1170 wdirrev = node.wdirrev 1170 wdirrev = node.wdirrev
1171 def matches(x): 1171 def matches(x):
1172 if x == wdirrev: 1172 if x == wdirrev:
1173 files = repo[x].files() 1173 files = repo[x].files()
1174 else: 1174 else:
1175 files = getchangeset(x)[3] 1175 files = getfiles(x)
1176 for f in files: 1176 for f in files:
1177 if m(f): 1177 if m(f):
1178 return True 1178 return True
1179 return False 1179 return False
1180 1180