Patchwork [1,of,5] manifest: add dirs() to manifestdict

login
register
mail settings
Submitter Drew Gottlieb
Date March 13, 2015, 11:35 p.m.
Message ID <2fcfb7b2ea15fd09a121.1426289733@waste.org>
Download mbox | patch
Permalink /patch/8072/
State Accepted
Commit f263814c72acfcca51bc40b697a00680dd8e9664
Headers show

Comments

Drew Gottlieb - March 13, 2015, 11:35 p.m.
# HG changeset patch
# User Drew Gottlieb <drgott@google.com>
# Date 1426285194 25200
#      Fri Mar 13 15:19:54 2015 -0700
# Node ID 2fcfb7b2ea15fd09a121f8893f120c9211ccb00b
# Parent  15afda349b11b531edd1ea6ec02847e01fe35615
manifest: add dirs() to manifestdict

Manifests should have a method of accessing its own dirs, not just the
context that references the manifest. This makes it easier for other
optimized versions of manifests to compute their own dirs in the most efficient
way.

Patch

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -6,9 +6,10 @@ 
 # GNU General Public License version 2 or any later version.
 
 from i18n import _
-import mdiff, parsers, error, revlog, util
+import mdiff, parsers, error, revlog, util, scmutil
 import array, struct
 
+propertycache = util.propertycache
 
 class _lazymanifest(dict):
     """This is the pure implementation of lazymanifest.
@@ -147,6 +148,13 @@ 
         files.difference_update(m2)
         return files
 
+    @propertycache
+    def _dirs(self):
+        return scmutil.dirs(self)
+
+    def dirs(self):
+        return self._dirs
+
     def matches(self, match):
         '''generate a new manifest filtered by the match argument'''
         if match.always():