Mercurial > hg-stable
changeset 537:411e05b04ffa
Propagate file list through dodiff
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Propagate file list through dodiff
This speeds up operations like 'hg diff Makefile'. Previously it would
walk the entire directory tree looking for changes. Now it will only
stat Makefile. Further, if Makefile appears untouched, it will skip
reading the manifest.
manifest hash: ab22a70a5511ed2d7a647f2cd15d129a88dccabf
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCxNRyywK+sNU5EO8RAgb6AKC2TzWmRjNsWq0Q9Pa+ppCZ6Y+pdwCfdHUA
UHu024/2Wt6C6WZ5vcWfPbo=
=E35L
-----END PGP SIGNATURE-----
author | mpm@selenic.com |
---|---|
date | Thu, 30 Jun 2005 21:28:18 -0800 |
parents | c15b4bc0a11c |
children | 7140bc781655 |
files | mercurial/commands.py mercurial/hg.py |
diffstat | 2 files changed, 13 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Thu Jun 30 20:54:01 2005 -0800 +++ b/mercurial/commands.py Thu Jun 30 21:28:18 2005 -0800 @@ -32,19 +32,24 @@ return [ util.pconvert(os.path.normpath(os.path.join(p, x))) for x in args ] return args -def dodiff(ui, repo, path, files = None, node1 = None, node2 = None): +def dodiff(ui, repo, files = None, node1 = None, node2 = None): def date(c): return time.asctime(time.gmtime(float(c[2].split(' ')[0]))) + (c, a, d, u) = repo.changes(None, node1, files) + if files: + c, a, d = map(lambda x: filterfiles(files, x), (c, a, d)) + + if not c and not a and not d: + return + if node2: change = repo.changelog.read(node2) mmap2 = repo.manifest.read(change[0]) - (c, a, d, u) = repo.changes(node1, node2) def read(f): return repo.file(f).read(mmap2[f]) date2 = date(change) else: date2 = time.asctime() - (c, a, d, u) = repo.changes(None, node1, path) if not node1: node1 = repo.dirstate.parents()[0] def read(f): return repo.wfile(f).read() @@ -59,9 +64,6 @@ mmap = repo.manifest.read(change[0]) date1 = date(change) - if files: - c, a, d = map(lambda x: filterfiles(files, x), (c, a, d)) - for f in c: to = None if f in mmap: @@ -411,7 +413,7 @@ else: files = relpath(repo, [""]) - dodiff(ui, repo, os.getcwd(), files, *revs) + dodiff(ui, repo, files, *revs) def export(ui, repo, changeset): """dump the changeset header and diffs for a revision""" @@ -428,7 +430,7 @@ print change[4].rstrip() print - dodiff(ui, repo, "", None, prev, node) + dodiff(ui, repo, None, prev, node) def forget(ui, repo, file, *files): """don't add the specified files on the next commit""" @@ -645,7 +647,7 @@ R = removed ? = not tracked''' - (c, a, d, u) = repo.changes(None, None, os.getcwd()) + (c, a, d, u) = repo.changes(None, None) (c, a, d, u) = map(lambda x: relfilter(repo, x), (c, a, d, u)) for f in c: print "C", f
--- a/mercurial/hg.py Thu Jun 30 20:54:01 2005 -0800 +++ b/mercurial/hg.py Thu Jun 30 21:28:18 2005 -0800 @@ -306,6 +306,7 @@ # recursive generator of all files listed def walk(files): for f in uniq(files): + f = os.path.join(self.root, f) if os.path.isdir(f): for dir, subdirs, fl in os.walk(f): d = dir[len(self.root) + 1:] @@ -691,7 +692,7 @@ self.dirstate.update(new, "n") self.dirstate.forget(remove) - def changes(self, node1, node2, *files): + def changes(self, node1, node2, files=None): # changed, added, deleted, unknown c, a, d, u, mf1 = [], [], [], [], None