mercurial/dirstate.py
changeset 1755 a8f7791e3680
parent 1749 d457fec76ab0
child 1794 98b6c1cad58b
--- a/mercurial/dirstate.py	Mon Feb 20 01:12:03 2006 +0100
+++ b/mercurial/dirstate.py	Mon Feb 20 19:04:56 2006 +0100
@@ -197,6 +197,19 @@
 
     def clear(self):
         self.map = {}
+        self.copies = {}
+        self.markdirty()
+
+    def rebuild(self, parent, files):
+        self.clear()
+        umask = os.umask(0)
+        os.umask(umask)
+        for f, mode in files:
+            if mode:
+                self.map[f] = ('n', ~umask, -1, 0)
+            else:
+                self.map[f] = ('n', ~umask & 0666, -1, 0)
+        self.pl = (parent, nullid)
         self.markdirty()
 
     def write(self):
@@ -406,7 +419,8 @@
             if type_ == 'n':
                 if not st:
                     st = os.stat(fn)
-                if size != st.st_size or (mode ^ st.st_mode) & 0100:
+                if size >= 0 and (size != st.st_size
+                                  or (mode ^ st.st_mode) & 0100):
                     modified.append(fn)
                 elif time != st.st_mtime:
                     lookup.append(fn)