Rev 412: Branch.tags.get_tag_dict doesn't cache, so cache for it. in http://bazaar.launchpad.net/~jameinel/loggerhead/tag_cache

John Arbash Meinel john at arbash-meinel.com
Mon Apr 26 22:04:25 BST 2010


At http://bazaar.launchpad.net/~jameinel/loggerhead/tag_cache

------------------------------------------------------------
revno: 412
revision-id: john at arbash-meinel.com-20100426210347-qakfesjc3id8oowe
parent: mnordhoff at mattnordhoff.com-20100424124017-do5wupmzlkmejtvk
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: tag_cache
timestamp: Mon 2010-04-26 16:03:47 -0500
message:
  Branch.tags.get_tag_dict doesn't cache, so cache for it.
-------------- next part --------------
=== modified file 'loggerhead/history.py'
--- a/loggerhead/history.py	2010-04-14 17:54:32 +0000
+++ b/loggerhead/history.py	2010-04-26 21:03:47 +0000
@@ -283,6 +283,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,))
@@ -653,11 +654,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