# HG changeset patch # User mpm@selenic.com # Date 1118592703 28800 # Node ID 09375250eb31431caca998715e48fc67d3f61cf3 # Parent 3b17056b72dc8c6d5c8ad0b8a140f7e53e3100d4 Optimize diff and status in subdirectories -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Optimize diff and status in subdirectories This walks the tree from the subdirectory down. Based on a patch by Arun Sharma manifest hash: 3a8545369b4eb6911b9d0fcdd8e4dc77784fa3d8 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCrF6/ywK+sNU5EO8RAosUAKC0KWcMfsLErEInDk1X1vpM54HFEgCfUwcN gXhaAviQZJ8h0ssl3BMmMfI= =KnRD -----END PGP SIGNATURE----- diff -r 3b17056b72dc -r 09375250eb31 mercurial/commands.py --- a/mercurial/commands.py Sat Jun 11 10:10:06 2005 -0800 +++ b/mercurial/commands.py Sun Jun 12 08:11:43 2005 -0800 @@ -32,7 +32,7 @@ return [ os.path.normpath(os.path.join(p, x)) for x in args ] return args -def dodiff(repo, files = None, node1 = None, node2 = None): +def dodiff(repo, path, files = None, node1 = None, node2 = None): def date(c): return time.asctime(time.gmtime(float(c[2].split(' ')[0]))) @@ -44,7 +44,7 @@ date2 = date(change) else: date2 = time.asctime() - (c, a, d, u) = repo.diffdir(repo.root, node1) + (c, a, d, u) = repo.diffdir(path, node1) if not node1: node1 = repo.dirstate.parents()[0] def read(f): return file(os.path.join(repo.root, f)).read() @@ -224,7 +224,7 @@ else: files = relpath(repo, [""]) - dodiff(repo, files, *revs) + dodiff(repo, os.getcwd(), files, *revs) def export(ui, repo, changeset): """dump the changeset header and diffs for a revision""" @@ -241,7 +241,7 @@ print change[4].rstrip() print - dodiff(repo, None, prev, node) + dodiff(repo, "", None, prev, node) def forget(ui, repo, file, *files): """don't add the specified files on the next commit""" @@ -449,8 +449,8 @@ A = added R = removed ? = not tracked''' - - (c, a, d, u) = repo.diffdir(repo.root) + + (c, a, d, u) = repo.diffdir(os.getcwd()) (c, a, d, u) = map(lambda x: relfilter(repo, x), (c, a, d, u)) for f in c: print "C", f diff -r 3b17056b72dc -r 09375250eb31 mercurial/hg.py --- a/mercurial/hg.py Sat Jun 11 10:10:06 2005 -0800 +++ b/mercurial/hg.py Sun Jun 12 08:11:43 2005 -0800 @@ -551,7 +551,7 @@ t2 = self.file(fn).revision(mf[fn]) return cmp(t1, t2) - for dir, subdirs, files in os.walk(self.root): + for dir, subdirs, files in os.walk(path): d = dir[len(self.root)+1:] if ".hg" in subdirs: subdirs.remove(".hg")