Patchwork [2,of,6] manifest: don't let find() look inside manifestdict

login
register
mail settings
Submitter Martin von Zweigbergk
Date March 11, 2015, 4:23 a.m.
Message ID <5671d3b1883e8fdce48e.1426047814@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/7996/
State Accepted
Commit 22d560fe1516516261f22cc822102e03115f9b58
Headers show

Comments

Martin von Zweigbergk - March 11, 2015, 4:23 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1426029973 25200
#      Tue Mar 10 16:26:13 2015 -0700
# Node ID 5671d3b1883e8fdce48e43aabce6ca5c86f6ea70
# Parent  1c855bc74470ff7f5a7805c085f95c279f0ef590
manifest: don't let find() look inside manifestdict

The find() method is currently implemented by looking inside the _lm
field of the manifest dict. Future manifests types (tree manifests)
may not have such a field, so add a method for getting to the data
instead.
Matt Mackall - March 11, 2015, 10:23 p.m.
On Tue, 2015-03-10 at 21:23 -0700, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1426029973 25200
> #      Tue Mar 10 16:26:13 2015 -0700
> # Node ID 5671d3b1883e8fdce48e43aabce6ca5c86f6ea70
> # Parent  1c855bc74470ff7f5a7805c085f95c279f0ef590
> manifest: don't let find() look inside manifestdict

I've queued these first two for default, thanks.

Patch

diff -r 1c855bc74470 -r 5671d3b1883e mercurial/manifest.py
--- a/mercurial/manifest.py	Mon Mar 09 17:13:22 2015 -0700
+++ b/mercurial/manifest.py	Tue Mar 10 16:26:13 2015 -0700
@@ -100,6 +100,9 @@ 
     def __getitem__(self, key):
         return self._lm[key][0]
 
+    def find(self, key):
+        return self._lm[key]
+
     def __len__(self):
         return len(self._lm)
 
@@ -352,7 +355,7 @@ 
             return m.get(f), m.flags(f)
         text = self.revision(node)
         try:
-            return manifestdict(text)._lm[f]
+            return manifestdict(text).find(f)
         except KeyError:
             return None, None