changeset 39342:57c3864f3aad

manifest: make tree a public attribute changegroup generation accesses this attribute. We should make it public and expose it on the interface. Differential Revision: https://phab.mercurial-scm.org/D4387
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 15 Aug 2018 16:50:44 +0000
parents 7f5e6d3e9032
children 53363a8eff57
files mercurial/changegroup.py mercurial/manifest.py mercurial/repository.py
diffstat 3 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changegroup.py	Mon Aug 27 10:15:15 2018 -0700
+++ b/mercurial/changegroup.py	Wed Aug 15 16:50:44 2018 +0000
@@ -1065,7 +1065,7 @@
             tree, nodes = tmfnodes.popitem()
             store = mfl.getstorage(tree)
 
-            if not self._filematcher.visitdir(store._tree[:-1] or '.'):
+            if not self._filematcher.visitdir(store.tree[:-1] or '.'):
                 prunednodes = []
             else:
                 frev, flr = store.rev, store.linkrev
--- a/mercurial/manifest.py	Mon Aug 27 10:15:15 2018 -0700
+++ b/mercurial/manifest.py	Wed Aug 15 16:50:44 2018 +0000
@@ -1285,7 +1285,8 @@
             if tree:
                 indexfile = "meta/" + tree + indexfile
 
-        self._tree = tree
+        self.tree = tree
+
         # The dirlogcache is kept on the root manifest log
         if tree:
             self._dirlogcache = dirlogcache
@@ -1330,7 +1331,7 @@
     def clearcaches(self, clear_persisted_data=False):
         self._revlog.clearcaches()
         self._fulltextcache.clear(clear_persisted_data=clear_persisted_data)
-        self._dirlogcache = {self._tree: self}
+        self._dirlogcache = {self.tree: self}
 
     def dirlog(self, d):
         if d:
@@ -1366,8 +1367,8 @@
             # process.
             if self._treeondisk:
                 assert readtree, "readtree must be set for treemanifest writes"
-                m1 = readtree(self._tree, p1)
-                m2 = readtree(self._tree, p2)
+                m1 = readtree(self.tree, p1)
+                m2 = readtree(self.tree, p2)
                 n = self._addtree(m, transaction, link, m1, m2, readtree)
                 arraytext = None
             else:
@@ -1383,7 +1384,7 @@
     def _addtree(self, m, transaction, link, m1, m2, readtree):
         # If the manifest is unchanged compared to one parent,
         # don't write a new revision
-        if self._tree != '' and (m.unmodifiedsince(m1) or m.unmodifiedsince(
+        if self.tree != '' and (m.unmodifiedsince(m1) or m.unmodifiedsince(
             m2)):
             return m.node()
         def writesubtree(subm, subp1, subp2):
@@ -1393,7 +1394,7 @@
         m.writesubtrees(m1, m2, writesubtree)
         text = m.dirtext()
         n = None
-        if self._tree != '':
+        if self.tree != '':
             # Double-check whether contents are unchanged to one parent
             if text == m1.dirtext():
                 n = m1.node()
--- a/mercurial/repository.py	Mon Aug 27 10:15:15 2018 -0700
+++ b/mercurial/repository.py	Wed Aug 15 16:50:44 2018 +0000
@@ -991,6 +991,12 @@
 class imanifeststorage(interfaceutil.Interface):
     """Storage interface for manifest data."""
 
+    tree = interfaceutil.Attribute(
+        """The path to the directory this manifest tracks.
+
+        The empty bytestring represents the root manifest.
+        """)
+
     index = interfaceutil.Attribute(
         """An ``ifilerevisionssequence`` instance.""")