changeset 312:09375250eb31

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-----
author mpm@selenic.com
date Sun, 12 Jun 2005 08:11:43 -0800
parents 3b17056b72dc
children e75ea4662d81
files mercurial/commands.py mercurial/hg.py
diffstat 2 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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")