Rev 1819: Avoid checking base paths if we know they exist. in file:///data/jelmer/bzr-svn/trunk/

Jelmer Vernooij jelmer at samba.org
Fri Sep 5 23:41:31 BST 2008


At file:///data/jelmer/bzr-svn/trunk/

------------------------------------------------------------
revno: 1819
revision-id: jelmer at samba.org-20080905224129-a2s8ogrg0u8pnw61
parent: jelmer at samba.org-20080905223129-mvbg5ljymyd2t3rg
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Sat 2008-09-06 00:41:29 +0200
message:
  Avoid checking base paths if we know they exist.
modified:
  commit.py                      commit.py-20060607190346-qvq128wgfubhhgm2-1
=== modified file 'commit.py'
--- a/commit.py	2008-09-05 22:08:42 +0000
+++ b/commit.py	2008-09-05 22:41:29 +0000
@@ -188,9 +188,11 @@
         self.visit_dirs = set()
         self.modified_files = {}
         if self.base_revid == NULL_REVISION:
+            self._base_revmeta = None
             self._base_branch_props = {}
         else:
-            self._base_branch_props = self.repository._revmeta_provider.get_revision(self.base_path, self.base_revnum).get_fileprops()
+            self._base_revmeta = self.repository._revmeta_provider.get_revision(self.base_path, self.base_revnum)
+            self._base_branch_props = self._base_revmeta.get_fileprops()
         self.supports_custom_revprops = self.repository.transport.has_capability("commit-revprops")
         if (self.supports_custom_revprops is None and 
             self.base_mapping.can_use_revprops and 
@@ -501,7 +503,14 @@
         self._svn_revprops[properties.PROP_REVISION_LOG] = message.encode("utf-8")
 
         try:
-            existing_bp_parts = _check_dirs_exist(self.repository.transport, 
+            # Shortcut - no need to see if dir exists if our base 
+            # was the last revision in the repo. This situation 
+            # happens a lot when pushing multiple subsequent revisions.
+            if (self.base_revnum == self.repository.get_latest_revnum() and 
+                self.base_path == self.branch.get_branch_path()):
+                existing_bp_parts = bp_parts
+            else:
+                existing_bp_parts = _check_dirs_exist(self.repository.transport, 
                                               bp_parts, -1)
             self.revision_metadata = None
             for prop in self._svn_revprops:
@@ -560,8 +569,6 @@
         finally:
             lock.unlock()
 
-        assert self.revision_metadata is not None
-
         (result_revision, result_date, result_author) = self.revision_metadata
         
         self._svn_revprops[properties.PROP_REVISION_AUTHOR] = result_author




More information about the bazaar-commits mailing list