files: cache repo.dirstate

For a large repo, 'hg files' goes from 2.27 seconds to 1.92.
This commit is contained in:
Siddharth Agarwal 2014-09-30 16:01:19 -07:00
parent 41071b4456
commit f1c5684fc4

View File

@ -3219,8 +3219,9 @@ def files(ui, repo, *pats, **opts):
fmt = '%s' + end
m = scmutil.match(ctx, pats, opts)
ds = repo.dirstate
for f in ctx.matches(m):
if rev is None and repo.dirstate[f] == 'r':
if rev is None and ds[f] == 'r':
continue
fm.startitem()
if ui.verbose: