##// END OF EJS Templates
Fix performance of hg diff....
Bryan O'Sullivan -
r837:a95c9b3f default
parent child Browse files
Show More
@@ -53,11 +53,17 b' def pathto(n1, n2):'
53 b.reverse()
53 b.reverse()
54 return os.sep.join((['..'] * len(a)) + b)
54 return os.sep.join((['..'] * len(a)) + b)
55
55
56 def walk(repo, pats, opts, head = ''):
56 def makewalk(repo, pats, opts, head = ''):
57 cwd = repo.getcwd()
57 cwd = repo.getcwd()
58 files, matchfn = matchpats(cwd, pats, opts, head)
58 files, matchfn = matchpats(cwd, pats, opts, head)
59 def walk():
59 for src, fn in repo.walk(files = files, match = matchfn):
60 for src, fn in repo.walk(files = files, match = matchfn):
60 yield src, fn, pathto(cwd, fn)
61 yield src, fn, pathto(cwd, fn)
62 return files, matchfn, walk()
63
64 def walk(repo, pats, opts, head = ''):
65 files, matchfn, results = makewalk(repo, pats, opts, head)
66 for r in results: yield r
61
67
62 revrangesep = ':'
68 revrangesep = ':'
63
69
@@ -153,11 +159,11 b' def make_file(repo, r, pat, node=None,'
153 return open(make_filename(repo, r, pat, node, total, seqno, revwidth),
159 return open(make_filename(repo, r, pat, node, total, seqno, revwidth),
154 mode)
160 mode)
155
161
156 def dodiff(fp, ui, repo, files=None, node1=None, node2=None):
162 def dodiff(fp, ui, repo, files=None, node1=None, node2=None, match=util.always):
157 def date(c):
163 def date(c):
158 return time.asctime(time.gmtime(float(c[2].split(' ')[0])))
164 return time.asctime(time.gmtime(float(c[2].split(' ')[0])))
159
165
160 (c, a, d, u) = repo.changes(node1, node2, files)
166 (c, a, d, u) = repo.changes(node1, node2, files, match = match)
161 if files:
167 if files:
162 c, a, d = map(lambda x: filterfiles(files, x), (c, a, d))
168 c, a, d = map(lambda x: filterfiles(files, x), (c, a, d))
163
169
@@ -588,9 +594,10 b' def diff(ui, repo, *pats, **opts):'
588 raise Abort("too many revisions to diff")
594 raise Abort("too many revisions to diff")
589
595
590 files = []
596 files = []
591 for src, abs, rel in walk(repo, pats, opts):
597 roots, match, results = makewalk(repo, pats, opts)
598 for src, abs, rel in results:
592 files.append(abs)
599 files.append(abs)
593 dodiff(sys.stdout, ui, repo, files, *revs)
600 dodiff(sys.stdout, ui, repo, files, *revs, **{'match': match})
594
601
595 def doexport(ui, repo, changeset, seqno, total, revwidth, opts):
602 def doexport(ui, repo, changeset, seqno, total, revwidth, opts):
596 node = repo.lookup(changeset)
603 node = repo.lookup(changeset)
General Comments 0
You need to be logged in to leave comments. Login now