comparison mercurial/cmdutil.py @ 24450:961790c35b4f

revert: take fast path also when not reverting to '.' This speeds up 'hg revert -r .^ --all --dry-run' on the Mozilla repo from 4.081s to 0.826s. Note that 'hg revert -r .^ .' does not get any faster, since '.' does not make match.always() True. I can't think of a reason it would break anything, and if it does, it's clearly not covered by tests.
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 24 Mar 2015 15:47:57 -0700
parents bab983bb6fd1
children c3bbafef25d6
comparison
equal deleted inserted replaced
24449:bab983bb6fd1 24450:961790c35b4f
2809 ## filling of the `names` mapping 2809 ## filling of the `names` mapping
2810 # walk dirstate to fill `names` 2810 # walk dirstate to fill `names`
2811 2811
2812 wctx = repo[None] 2812 wctx = repo[None]
2813 m = scmutil.match(wctx, pats, opts) 2813 m = scmutil.match(wctx, pats, opts)
2814 if not m.always() or node != parent: 2814 if not m.always():
2815 m.bad = lambda x, y: False 2815 m.bad = lambda x, y: False
2816 for abs in repo.walk(m): 2816 for abs in repo.walk(m):
2817 names[abs] = m.rel(abs), m.exact(abs) 2817 names[abs] = m.rel(abs), m.exact(abs)
2818 2818
2819 # walk target manifest to fill `names` 2819 # walk target manifest to fill `names`
2838 m = scmutil.matchfiles(repo, names) 2838 m = scmutil.matchfiles(repo, names)
2839 2839
2840 changes = repo.status(node1=node, match=m, 2840 changes = repo.status(node1=node, match=m,
2841 unknown=True, ignored=True, clean=True) 2841 unknown=True, ignored=True, clean=True)
2842 else: 2842 else:
2843 changes = repo.status(match=m) 2843 changes = repo.status(node1=node, match=m)
2844 for kind in changes: 2844 for kind in changes:
2845 for abs in kind: 2845 for abs in kind:
2846 names[abs] = m.rel(abs), m.exact(abs) 2846 names[abs] = m.rel(abs), m.exact(abs)
2847 2847
2848 m = scmutil.matchfiles(repo, names) 2848 m = scmutil.matchfiles(repo, names)