Mercurial > hg
comparison mercurial/manifest.py @ 24292:b7add2ebef9e
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.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 11 Mar 2015 08:28:56 -0700 |
parents | 22d560fe1516 |
children | 2b7ab29627fd |
comparison
equal
deleted
inserted
replaced
24291:760a86865f80 | 24292:b7add2ebef9e |
---|---|
348 return m | 348 return m |
349 | 349 |
350 def find(self, node, f): | 350 def find(self, node, f): |
351 '''look up entry for a single file efficiently. | 351 '''look up entry for a single file efficiently. |
352 return (node, flags) pair if found, (None, None) if not.''' | 352 return (node, flags) pair if found, (None, None) if not.''' |
353 if node in self._mancache: | 353 m = self.read(node) |
354 m = self._mancache[node][0] | |
355 return m.get(f), m.flags(f) | |
356 text = self.revision(node) | |
357 try: | 354 try: |
358 return manifestdict(text).find(f) | 355 return m.find(f) |
359 except KeyError: | 356 except KeyError: |
360 return None, None | 357 return None, None |
361 | 358 |
362 def add(self, m, transaction, link, p1, p2, added, removed): | 359 def add(self, m, transaction, link, p1, p2, added, removed): |
363 if p1 in self._mancache: | 360 if p1 in self._mancache: |