More tweaking to rawcommit for repo conversion
authormpm@selenic.com
Sun, 12 Jun 2005 08:48:01 -0800
changeset 314 3402cb9a4c06
parent 313 e75ea4662d81
child 315 5f0231b29f42
More tweaking to rawcommit for repo conversion -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 More tweaking to rawcommit for repo conversion manifest hash: 912e7d61fc15845fd24baada9f553c2d38b26f06 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCrGdBywK+sNU5EO8RApbrAKCPVvxnSgkzAWpwc6uRDCCYAsqO7QCeMonn tZS4URbMI2aDQYw15wDEZHg= =C2Vn -----END PGP SIGNATURE-----
mercurial/hg.py
--- a/mercurial/hg.py	Sun Jun 12 08:23:29 2005 -0800
+++ b/mercurial/hg.py	Sun Jun 12 08:48:01 2005 -0800
@@ -439,6 +439,7 @@
         mm = m1.copy()
         mfm = mf1.copy()
         linkrev = self.changelog.count()
+        self.dirstate.setparents(p1, p2)
         for f in files:
             try:
                 t = self.wfile(f).read()
@@ -447,16 +448,19 @@
                 mfm[f] = tm
                 mm[f] = r.add(t, tr, linkrev,
                               m1.get(f, nullid), m2.get(f, nullid))
+                self.dirstate.update([f], "n")
             except IOError:
-                del mm[f]
-                del mfm[f]
+                try:
+                    del mm[f]
+                    del mfm[f]
+                    self.dirstate.forget([f])
+                except:
+                    # deleted from p2?
+                    pass
 
         mnode = self.manifest.add(mm, mfm, tr, linkrev, c1[0], c2[0])
         n = self.changelog.add(mnode, files, text, tr, p1, p2, user, date)
         tr.close()
-        self.dirstate.setparents(p1, p2)
-        self.dirstate.clear()
-        self.dirstate.update(files, "n")
 
     def commit(self, files = None, text = ""):
         commit = []