Rev 1291: use capabilities. in http://people.samba.org/bzr/jelmer/bzr-svn/0.4

Jelmer Vernooij jelmer at samba.org
Sun Jun 22 23:49:28 BST 2008


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

------------------------------------------------------------
revno: 1291
revision-id: jelmer at samba.org-20080622224927-9u06e34mzxmo0om3
parent: jelmer at samba.org-20080622224440-9pvj22asefpw38yg
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Mon 2008-06-23 00:49:27 +0200
message:
  use capabilities.
modified:
  logwalker.py                   logwalker.py-20060621215743-c13fhfnyzh1xzwh2-1
  transport.py                   transport.py-20060406231150-b3472d06b3a0818d
=== modified file 'logwalker.py'
--- a/logwalker.py	2008-06-22 22:30:18 +0000
+++ b/logwalker.py	2008-06-22 22:49:27 +0000
@@ -346,14 +346,15 @@
 
         try:
             # Subversion 1.4 clients and servers can only deliver a limited set of revprops
+            todo_revprops = ["svn:author", "svn:log", "svn:date"]
             try:
-                iterator = self._transport.iter_log(paths, from_revnum, to_revnum, limit, 
-                                                    True, False, False, revprops=None)
-                has_all_revprops = True
+                if self._transport.has_capability("log-revprops"):
+                    todo_revprops = None
             except NotImplementedError:
-                iterator = self._transport.iter_log(paths, from_revnum, to_revnum, limit, 
-                        True, False, False, revprops=["svn:author", "svn:log", "svn:date"])
-                has_all_revprops = False
+                pass
+
+            iterator = self._transport.iter_log(paths, from_revnum, to_revnum, limit, 
+                                                    True, False, False, revprops=todo_revprops)
 
             for (changed_paths, revnum, known_revprops, has_children) in iterator:
                 if pb is not None:
@@ -363,7 +364,7 @@
                 else:
                     assert isinstance(changed_paths, dict), "invalid paths %r in %r" % (changed_paths, revnum)
                     revpaths = struct_revpaths_to_tuples(changed_paths)
-                if has_all_revprops:
+                if todo_revprops is None:
                     revprops = known_revprops
                 else:
                     revprops = lazy_dict(known_revprops, self._transport.revprop_list, revnum)

=== modified file 'transport.py'
--- a/transport.py	2008-06-22 22:30:18 +0000
+++ b/transport.py	2008-06-22 22:49:27 +0000
@@ -155,6 +155,8 @@
         else:
             self.connections = pool
 
+        self.capabilities = {}
+
         from bzrlib.plugins.svn import lazy_check_versions
         lazy_check_versions()
 
@@ -387,10 +389,13 @@
         return conn.do_update(revnum, path, recurse, editor)
 
     def has_capability(self, cap):
+        if cap in self.capabilities:
+            return self.capabilities[cap]
         conn = self.get_connection()
         self.mutter('svn has-capability %s' % (cap,))
         try:
-            return conn.has_capability(cap)
+            self.capabilities[cap] = conn.has_capability(cap)
+            return self.capabilities[cap]
         finally:
             self.add_connection(conn)
 




More information about the bazaar-commits mailing list