commit: update file nodeid and flags in the same place
authorMartin von Zweigbergk <martinvonz@gmail.com>
Mon, 13 Oct 2014 14:18:47 -0700
changeset 22910 4f2a5c7cdf78
parent 22909 4545c5b53013
child 22911 509e2cbee679
commit: update file nodeid and flags in the same place Now that we have a separate variable for the original 'm1' manifest, we can safely update the nodeid of the file in the new manifest in the same place as we update the flags.
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Mon Oct 13 14:11:47 2014 -0700
+++ b/mercurial/localrepo.py	Mon Oct 13 14:18:47 2014 -0700
@@ -1392,7 +1392,7 @@
                 m = m1.copy()
 
                 # check in files
-                new = {}
+                added = []
                 changed = []
                 removed = list(ctx.removed())
                 linkrev = len(self)
@@ -1403,8 +1403,9 @@
                         if fctx is None:
                             removed.append(f)
                         else:
-                            new[f] = self._filecommit(fctx, m1, m2, linkrev,
-                                                      trp, changed)
+                            added.append(f)
+                            m[f] = self._filecommit(fctx, m1, m2, linkrev,
+                                                    trp, changed)
                             m.set(f, fctx.flags())
                     except OSError, inst:
                         self.ui.warn(_("trouble committing %s!\n") % f)
@@ -1416,14 +1417,13 @@
                         raise
 
                 # update manifest
-                m.update(new)
                 removed = [f for f in sorted(removed) if f in m1 or f in m2]
                 drop = [f for f in removed if f in m]
                 for f in drop:
                     del m[f]
                 mn = self.manifest.add(m, trp, linkrev,
                                        p1.manifestnode(), p2.manifestnode(),
-                                       new, drop)
+                                       added, drop)
                 files = changed + removed
             else:
                 mn = p1.manifestnode()