# HG changeset patch # User Siddharth Agarwal # Date 2014-09-30 23:01:19 # Node ID 1257cc6c1a2f23eb574737ab5774c8fad1fc0acd # Parent ec47d4fde26db0d76d087ca74825d115d2b9486f files: cache repo.dirstate For a large repo, 'hg files' goes from 2.27 seconds to 1.92. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -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: