Patchwork [2,of,4] manifest: call m1.load and m2.load before writing a subtree

login
register
mail settings
Submitter Durham Goode
Date Aug. 30, 2016, 11:40 p.m.
Message ID <22aaea9ec22e3dea58ad.1472600442@dev8486.prn1.facebook.com>
Download mbox | patch
Permalink /patch/16498/
State Accepted
Headers show

Comments

Durham Goode - Aug. 30, 2016, 11:40 p.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1472518094 25200
#      Mon Aug 29 17:48:14 2016 -0700
# Node ID 22aaea9ec22e3dea58ad184476cc123c22c25b11
# Parent  a6f968072eb72212bf8e16fb74114654aca98330
manifest: call m1.load and m2.load before writing a subtree

As part of refactoring the manifest, certain test cases started failing because
writesubtrees was called with p1 and p2 manifests that had not been loaded (so
accessing m1._dirs resulted in an empty set). Let's call _load on these before
attempting to access _dirs.

This was caught by tests when future patches were applied.
via Mercurial-devel - Aug. 31, 2016, 4:40 p.m.
This seems like a good bugfix. I'm queuing this, thanks.

On Tue, Aug 30, 2016 at 4:40 PM, Durham Goode <durham@fb.com> wrote:
> # HG changeset patch
> # User Durham Goode <durham@fb.com>
> # Date 1472518094 25200
> #      Mon Aug 29 17:48:14 2016 -0700
> # Node ID 22aaea9ec22e3dea58ad184476cc123c22c25b11
> # Parent  a6f968072eb72212bf8e16fb74114654aca98330
> manifest: call m1.load and m2.load before writing a subtree
>
> As part of refactoring the manifest, certain test cases started failing because
> writesubtrees was called with p1 and p2 manifests that had not been loaded (so
> accessing m1._dirs resulted in an empty set). Let's call _load on these before
> attempting to access _dirs.
>
> This was caught by tests when future patches were applied.
>
> diff --git a/mercurial/manifest.py b/mercurial/manifest.py
> --- a/mercurial/manifest.py
> +++ b/mercurial/manifest.py
> @@ -882,6 +882,8 @@ class treemanifest(object):
>
>      def writesubtrees(self, m1, m2, writesubtree):
>          self._load() # for consistency; should never have any effect here
> +        m1._load()
> +        m2._load()
>          emptytree = treemanifest()
>          for d, subm in self._dirs.iteritems():
>              subp1 = m1._dirs.get(d, emptytree)._node
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -882,6 +882,8 @@  class treemanifest(object):
 
     def writesubtrees(self, m1, m2, writesubtree):
         self._load() # for consistency; should never have any effect here
+        m1._load()
+        m2._load()
         emptytree = treemanifest()
         for d, subm in self._dirs.iteritems():
             subp1 = m1._dirs.get(d, emptytree)._node