Rev 413: Cache the Branch reverse-tag dict, since Branch does not. in http://bazaar.launchpad.net/~loggerhead-team/loggerhead/trunk-rich

John Arbash Meinel john at arbash-meinel.com
Tue Apr 27 16:46:47 BST 2010


At http://bazaar.launchpad.net/~loggerhead-team/loggerhead/trunk-rich

------------------------------------------------------------
revno: 413 [merge]
revision-id: john at arbash-meinel.com-20100427154552-ebb7psd96xwmgo0e
parent: michael.hudson at canonical.com-20100426235740-juqy4qzq6djtreq4
parent: john at arbash-meinel.com-20100426210347-qakfesjc3id8oowe
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: trunk-rich
timestamp: Tue 2010-04-27 10:45:52 -0500
message:
  Cache the Branch reverse-tag dict, since Branch does not.
modified:
  loggerhead/history.py          history.py-20061211064342-102iqirsciyvgtcf-5
-------------- next part --------------
=== modified file 'loggerhead/history.py'
--- a/loggerhead/history.py	2010-04-23 02:46:55 +0000
+++ b/loggerhead/history.py	2010-04-27 15:45:52 +0000
@@ -294,6 +294,7 @@
         else:
             self._file_change_cache = None
         self._branch = branch
+        self._branch_tags = None
         self._inventory_cache = {}
         self._branch_nick = self._branch.get_config().get_nickname()
         self.log = logging.getLogger('loggerhead.%s' % (self._branch_nick,))
@@ -664,11 +665,12 @@
         """
         message, short_message = clean_message(revision.message)
 
-        tags = self._branch.tags.get_reverse_tag_dict()
+        if self._branch_tags is None:
+            self._branch_tags = self._branch.tags.get_reverse_tag_dict()
 
         revtags = None
-        if tags.has_key(revision.revision_id):
-          revtags = ', '.join(tags[revision.revision_id])
+        if revision.revision_id in self._branch_tags:
+          revtags = ', '.join(self._branch_tags[revision.revision_id])
 
         entry = {
             'revid': revision.revision_id,



More information about the bazaar-commits mailing list