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.
--- a/mercurial/cmdutil.py Tue Mar 24 13:56:51 2015 -0700
+++ b/mercurial/cmdutil.py Tue Mar 24 15:47:57 2015 -0700
@@ -2811,7 +2811,7 @@
wctx = repo[None]
m = scmutil.match(wctx, pats, opts)
- if not m.always() or node != parent:
+ if not m.always():
m.bad = lambda x, y: False
for abs in repo.walk(m):
names[abs] = m.rel(abs), m.exact(abs)
@@ -2840,7 +2840,7 @@
changes = repo.status(node1=node, match=m,
unknown=True, ignored=True, clean=True)
else:
- changes = repo.status(match=m)
+ changes = repo.status(node1=node, match=m)
for kind in changes:
for abs in kind:
names[abs] = m.rel(abs), m.exact(abs)