diff mercurial/commands.py @ 812:b65af904d6d7

Reduce the amount of stat traffic generated by a walk. When we switched to the new walk code for commands, we no longer passed a list of specific files to the repo or dirstate walk or changes methods. This meant that we always walked and attempted to match everything, which was not efficient. Now, if we are given any patterns to match, or nothing at all, we still walk everything. But if we are given only file names that contain no glob characters, we only walk those.
author Bryan O'Sullivan <bos@serpentine.com>
date Fri, 29 Jul 2005 12:30:12 -0800
parents 790a0ff306f2
children 80fd2958235a
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Jul 29 08:51:42 2005 -0800
+++ b/mercurial/commands.py	Fri Jul 29 12:30:12 2005 -0800
@@ -47,7 +47,8 @@
     cwd = repo.getcwd()
     c = 0
     if cwd: c = len(cwd) + 1
-    for src, fn in repo.walk(match = matchpats(cwd, pats, opts, head)):
+    files, matchfn = matchpats(cwd, pats, opts, head)
+    for src, fn in repo.walk(files = files, match = matchfn):
         yield src, fn, fn[c:]
 
 revrangesep = ':'
@@ -1007,7 +1008,8 @@
     R = removed
     ? = not tracked'''
 
-    (c, a, d, u) = repo.changes(match = matchpats(repo.getcwd(), pats, opts))
+    files, matchfn = matchpats(repo.getcwd(), pats, opts)
+    (c, a, d, u) = repo.changes(files = files, match = matchfn)
     (c, a, d, u) = map(lambda x: relfilter(repo, x), (c, a, d, u))
 
     for f in c: