Rev 1328: Cache repos root and uuid. in http://people.samba.org/bzr/jelmer/bzr-svn/0.4

Jelmer Vernooij jelmer at samba.org
Tue Jun 24 01:16:11 BST 2008


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

------------------------------------------------------------
revno: 1328
revision-id: jelmer at samba.org-20080624001610-4teth3d824ton0vk
parent: jelmer at samba.org-20080624001156-ucbseqlxhfeuah9o
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Tue 2008-06-24 02:16:10 +0200
message:
  Cache repos root and uuid.
modified:
  transport.py                   transport.py-20060406231150-b3472d06b3a0818d
=== modified file 'transport.py'
--- a/transport.py	2008-06-23 18:15:42 +0000
+++ b/transport.py	2008-06-24 00:16:10 +0000
@@ -160,6 +160,8 @@
         else:
             self.connections = pool
 
+        self._repos_root = None
+        self._uuid = None
         self.capabilities = {}
 
         from bzrlib.plugins.svn import lazy_check_versions
@@ -188,12 +190,14 @@
         raise TransportNotPossible('stat not supported on Subversion')
 
     def get_uuid(self):
-        conn = self.get_connection()
-        self.mutter('svn get-uuid')
-        try:
-            return conn.get_uuid()
-        finally:
-            self.add_connection(conn)
+        if self._uuid is None:
+            conn = self.get_connection()
+            self.mutter('svn get-uuid')
+            try:
+                return conn.get_uuid()
+            finally:
+                self.add_connection(conn)
+        return self._uuid
 
     def get_repos_root(self):
         root = self.get_svn_repos_root()
@@ -203,12 +207,14 @@
         return root
 
     def get_svn_repos_root(self):
-        conn = self.get_connection()
-        self.mutter('svn get-repos-root')
-        try:
-            return conn.get_repos_root()
-        finally:
-            self.add_connection(conn)
+        if self._repos_root is None:
+            self.mutter('svn get-repos-root')
+            conn = self.get_connection()
+            try:
+                self._repos_root = conn.get_repos_root()
+            finally:
+                self.add_connection(conn)
+        return self._repos_root
 
     def get_latest_revnum(self):
         conn = self.get_connection()




More information about the bazaar-commits mailing list