Rev 2111: Cache results from consider_* functions. in http://people.samba.org/bzr/jelmer/bzr-svn/0.5

Jelmer Vernooij jelmer at samba.org
Sun Nov 30 21:27:51 GMT 2008


At http://people.samba.org/bzr/jelmer/bzr-svn/0.5

------------------------------------------------------------
revno: 2111
revision-id: jelmer at samba.org-20081130212749-op3jap6kxqcf04gh
parent: jelmer at samba.org-20081130211230-iweiksl1ewqnsvm4
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.5
timestamp: Sun 2008-11-30 22:27:49 +0100
message:
  Cache results from consider_* functions.
modified:
  revmeta.py                     revmeta.py-20080901215045-n8a6arqybs9ez5hl-1
=== modified file 'revmeta.py'
--- a/revmeta.py	2008-11-30 19:56:48 +0000
+++ b/revmeta.py	2008-11-30 21:27:49 +0000
@@ -98,8 +98,11 @@
         self._fileprops = fileprops
         self._is_bzr_revision = None
         self._direct_lhs_parent_known = False
+        self._consider_bzr_fileprops = None
+        self._consider_svk_fileprops = None
         self.metabranch = metabranch
         self.uuid = uuid
+        self.descendants = set()
 
     def __eq__(self, other):
         return (type(self) == type(other) and 
@@ -478,10 +481,15 @@
                                              self.get_changed_fileprops())
 
     def consider_bzr_fileprops(self):
-        return self.metabranch is None or self.metabranch.consider_bzr_fileprops(self)
+        if self._consider_bzr_fileprops is not None:
+            return self._consider_bzr_fileprops
+        self._consider_bzr_fileprops = (self.metabranch is None or self.metabranch.consider_bzr_fileprops(self))
 
     def consider_svk_fileprops(self):
-        return self.metabranch is None or self.metabranch.consider_svk_fileprops(self)
+        if self._consider_svk_fileprops is not None:
+            return self._consider_svk_fileprops
+        self._consider_svk_fileprops = (self.metabranch is None or self.metabranch.consider_svk_fileprops(self))
+        return self._consider_svk_fileprops
 
     def get_roundtrip_ancestor_revids(self):
         if not self.consider_bzr_fileprops():




More information about the bazaar-commits mailing list