changeset 230:00ea3613f82c

make diffdir default to dirstate.parents() -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 make diffdir default to dirstate.parents() update various diffdir users to use default manifest hash: aeca2b9da1aca278dd5e3f27cc2906667803577d -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCoMPcywK+sNU5EO8RAkY8AJ90UHQXnJnkG9PJKG7IsgPeOZ2WZACgiarS HhS2zX3TRM9WdZHo5nLvZGw= =7YyP -----END PGP SIGNATURE-----
author mpm@selenic.com
date Fri, 03 Jun 2005 12:55:56 -0800
parents 1b11da6ee69e
children 15e7c6cee929
files hg mercurial/commands.py mercurial/hg.py
diffstat 3 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/hg	Fri Jun 03 12:54:54 2005 -0800
+++ b/hg	Fri Jun 03 12:55:56 2005 -0800
@@ -250,7 +250,7 @@
     repo.addchangegroup(data)
 
 elif cmd == "addremove":
-    (c, a, d, u) = repo.diffdir(repo.root, repo.current)
+    (c, a, d, u) = repo.diffdir(repo.root)
     repo.add(a)
     repo.remove(d)
     
--- a/mercurial/commands.py	Fri Jun 03 12:54:54 2005 -0800
+++ b/mercurial/commands.py	Fri Jun 03 12:55:56 2005 -0800
@@ -70,7 +70,7 @@
 
 def checkout(ui, repo, changeset=None):
     '''checkout a given changeset or the current tip'''
-    (c, a, d, u) = repo.diffdir(repo.root, repo.current)
+    (c, a, d, u) = repo.diffdir(repo.root)
     if c or a or d:
         ui.warn("aborting (outstanding changes in working directory)\n")
         sys.exit(1)
@@ -160,7 +160,7 @@
 A = added
 R = removed
 ? = not tracked'''
-    (c, a, d, u) = repo.diffdir(repo.root, repo.current)
+    (c, a, d, u) = repo.diffdir(repo.root)
     (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	Fri Jun 03 12:54:54 2005 -0800
+++ b/mercurial/hg.py	Fri Jun 03 12:55:56 2005 -0800
@@ -426,7 +426,7 @@
                 else:
                     self.warn("%s not tracked!\n")
         else:
-            (c, a, d, u) = self.diffdir(self.root, parent)
+            (c, a, d, u) = self.diffdir(self.root)
             commit = c + a
             remove = d
 
@@ -501,7 +501,7 @@
         self.dirstate.clear()
         self.dirstate.update([f for f,n in l], "n")
 
-    def diffdir(self, path, changeset):
+    def diffdir(self, path, changeset = None):
         changed = []
         added = []
         unknown = []
@@ -510,11 +510,12 @@
         if changeset:
             change = self.changelog.read(changeset)
             mf = self.manifest.read(change[0])
-
-        if changeset == self.current:
+            dc = dict.fromkeys(mf)
+        else:
+            changeset = self.dirstate.parents()[0]
+            change = self.changelog.read(changeset)
+            mf = self.manifest.read(change[0])
             dc = self.dirstate.copy()
-        else:
-            dc = dict.fromkeys(mf)
 
         def fcmp(fn):
             t1 = file(os.path.join(self.root, fn)).read()
@@ -535,7 +536,7 @@
                     if not c:
                         if fcmp(fn):
                             changed.append(fn)
-                    if c[0] == 'i':
+                    elif c[0] == 'i':
                         if fn not in mf:
                             added.append(fn)
                         elif fcmp(fn):