Patchwork [1,of,2] manifest: duplicate call to addrevision()

login
register
mail settings
Submitter Martin von Zweigbergk
Date April 15, 2015, 8:01 p.m.
Message ID <5f952de4d34db74ec43c.1429128072@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/8687/
State Accepted
Headers show

Comments

Martin von Zweigbergk - April 15, 2015, 8:01 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1428874675 25200
#      Sun Apr 12 14:37:55 2015 -0700
# Node ID 5f952de4d34db74ec43c07d7f0c893b8976fff73
# Parent  c00e4338fa4b316a73a35d39ea57a3d8e7d407e0
manifest: duplicate call to addrevision()

When we start writing submanifests to their own revlogs, we will not
want to write a new revision for a directory if there were no changes
to it. To prepare for this, duplicate the call to addrevision() and
move them earlier where they can more easily be avoided.

Patch

diff -r c00e4338fa4b -r 5f952de4d34d mercurial/manifest.py
--- a/mercurial/manifest.py	Tue Apr 14 11:44:04 2015 -0400
+++ b/mercurial/manifest.py	Sun Apr 12 14:37:55 2015 -0700
@@ -836,6 +836,7 @@ 
             arraytext, deltatext = m.fastdelta(self._mancache[p1][1], work)
             cachedelta = self.rev(p1), deltatext
             text = util.buffer(arraytext)
+            n = self.addrevision(text, transaction, link, p1, p2, cachedelta)
         else:
             # The first parent manifest isn't already loaded, so we'll
             # just encode a fulltext of the manifest and pass that
@@ -843,9 +844,8 @@ 
             # process.
             text = m.text(self._usemanifestv2)
             arraytext = array.array('c', text)
-            cachedelta = None
+            n = self.addrevision(text, transaction, link, p1, p2)
 
-        n = self.addrevision(text, transaction, link, p1, p2, cachedelta)
         self._mancache[n] = (m, arraytext)
 
         return n