From patchwork Wed Mar 11 16:21:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [7,of,6] manifest: rewrite find(node, f) in terms of read(node) From: Martin von Zweigbergk X-Patchwork-Id: 8005 Message-Id: <2598d47afb032b232898.1426090913@martinvonz.mtv.corp.google.com> To: mercurial-devel@selenic.com Cc: Pierre-Yves David Date: Wed, 11 Mar 2015 09:21:53 -0700 # HG changeset patch # User Martin von Zweigbergk # Date 1426087736 25200 # Wed Mar 11 08:28:56 2015 -0700 # Node ID 2598d47afb032b232898275a77d5f830c9c89eec # Parent 4ebfeb027ce588a72347788c8c23b2318d8fb6d3 manifest: rewrite find(node, f) in terms of read(node) Since find() now always works with a full manifest, we can simplify by calling read() to give us that manifest. That way, we also populate the manifest cache. However, now that we no longer parse the manifest text into a Python type (thanks, lazymanifest/Augie), the cost of parsing (scanning for newlines, really) is small enough that it seems generally drowned by revlog reading. diff -r 4ebfeb027ce5 -r 2598d47afb03 mercurial/manifest.py --- a/mercurial/manifest.py Tue Mar 03 13:50:06 2015 -0800 +++ b/mercurial/manifest.py Wed Mar 11 08:28:56 2015 -0700 @@ -595,12 +595,9 @@ def find(self, node, f): '''look up entry for a single file efficiently. return (node, flags) pair if found, (None, None) if not.''' - if node in self._mancache: - m = self._mancache[node][0] - return m.get(f), m.flags(f) - text = self.revision(node) + m = self.read(node) try: - return self._newmanifest(text).find(f) + return m.find(f) except KeyError: return None, None