files: use ctx.matches instead of ctx.walk
authorSiddharth Agarwal <sid0@fb.com>
Tue, 30 Sep 2014 14:39:58 -0700
changeset 22592 ff3ccc592af4
parent 22591 9fe33afc00b4
child 22593 ec47d4fde26d
files: use ctx.matches instead of ctx.walk ctx.matches() is an optimized form of ctx.walk() when we don't care about the state of files on disk. For a large repo, 'hg files > /dev/null' drops from 3.7 seconds to 2.3.
mercurial/commands.py
--- a/mercurial/commands.py	Tue Sep 30 15:45:48 2014 -0700
+++ b/mercurial/commands.py	Tue Sep 30 14:39:58 2014 -0700
@@ -3219,7 +3219,7 @@
     fmt = '%s' + end
 
     m = scmutil.match(ctx, pats, opts)
-    for f in ctx.walk(m):
+    for f in ctx.matches(m):
         if rev is None and repo.dirstate[f] in 'r?!':
             continue
         fm.startitem()