comparison 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
comparison
equal deleted inserted replaced
811:fa9aaf3bbdd7 812:b65af904d6d7
45 45
46 def walk(repo, pats, opts, head = ''): 46 def walk(repo, pats, opts, head = ''):
47 cwd = repo.getcwd() 47 cwd = repo.getcwd()
48 c = 0 48 c = 0
49 if cwd: c = len(cwd) + 1 49 if cwd: c = len(cwd) + 1
50 for src, fn in repo.walk(match = matchpats(cwd, pats, opts, head)): 50 files, matchfn = matchpats(cwd, pats, opts, head)
51 for src, fn in repo.walk(files = files, match = matchfn):
51 yield src, fn, fn[c:] 52 yield src, fn, fn[c:]
52 53
53 revrangesep = ':' 54 revrangesep = ':'
54 55
55 def revrange(ui, repo, revs, revlog=None): 56 def revrange(ui, repo, revs, revlog=None):
1005 M = modified 1006 M = modified
1006 A = added 1007 A = added
1007 R = removed 1008 R = removed
1008 ? = not tracked''' 1009 ? = not tracked'''
1009 1010
1010 (c, a, d, u) = repo.changes(match = matchpats(repo.getcwd(), pats, opts)) 1011 files, matchfn = matchpats(repo.getcwd(), pats, opts)
1012 (c, a, d, u) = repo.changes(files = files, match = matchfn)
1011 (c, a, d, u) = map(lambda x: relfilter(repo, x), (c, a, d, u)) 1013 (c, a, d, u) = map(lambda x: relfilter(repo, x), (c, a, d, u))
1012 1014
1013 for f in c: 1015 for f in c:
1014 ui.write("M ", f, "\n") 1016 ui.write("M ", f, "\n")
1015 for f in a: 1017 for f in a: