comparison mercurial/commands.py @ 22594:1257cc6c1a2f

files: cache repo.dirstate For a large repo, 'hg files' goes from 2.27 seconds to 1.92.
author Siddharth Agarwal <sid0@fb.com>
date Tue, 30 Sep 2014 16:01:19 -0700
parents ec47d4fde26d
children 1625770c2ce1
comparison
equal deleted inserted replaced
22593:ec47d4fde26d 22594:1257cc6c1a2f
3217 end = '\0' 3217 end = '\0'
3218 fm = ui.formatter('files', opts) 3218 fm = ui.formatter('files', opts)
3219 fmt = '%s' + end 3219 fmt = '%s' + end
3220 3220
3221 m = scmutil.match(ctx, pats, opts) 3221 m = scmutil.match(ctx, pats, opts)
3222 ds = repo.dirstate
3222 for f in ctx.matches(m): 3223 for f in ctx.matches(m):
3223 if rev is None and repo.dirstate[f] == 'r': 3224 if rev is None and ds[f] == 'r':
3224 continue 3225 continue
3225 fm.startitem() 3226 fm.startitem()
3226 if ui.verbose: 3227 if ui.verbose:
3227 fc = ctx[f] 3228 fc = ctx[f]
3228 fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags()) 3229 fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags())