[PATCH 3 of 3] localrepo: update file nodeid and flags in the same place

Martin von Zweigbergk martinvonz at gmail.com
Mon Oct 13 16:42:10 CDT 2014


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at gmail.com>
# Date 1413235127 25200
#      Mon Oct 13 14:18:47 2014 -0700
# Node ID 0d5f627436419322a34cda463c960ed3c1a6a99f
# Parent  cf50d9c4b1c911eca17575d8c92cf1ecdd66887d
localrepo: 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.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1387,7 +1387,7 @@
                 m = m1.copy()
 
                 # check in files
-                new = {}
+                added = []
                 changed = []
                 linkrev = len(self)
                 for f in sorted(ctx.modified() + ctx.added()):
@@ -1397,8 +1397,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)
@@ -1410,14 +1411,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()


More information about the Mercurial-devel mailing list