Rev 2121: More efficient fetching of file properties. in http://people.samba.org/bzr/jelmer/bzr-svn/0.5

Jelmer Vernooij jelmer at samba.org
Mon Dec 1 03:57:38 GMT 2008


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

------------------------------------------------------------
revno: 2121
revision-id: jelmer at samba.org-20081201035735-uctk1209p4nryo84
parent: jelmer at samba.org-20081201033727-nc1ak28jt4nljt5k
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.5
timestamp: Mon 2008-12-01 04:57:35 +0100
message:
  More efficient fetching of file properties.
modified:
  branchprops.py                 branchprops.py-20061223204623-80lvm7pjrpsgk0dd-1
  fetch.py                       fetch.py-20060625004942-x2lfaib8ra707a8p-1
  revmeta.py                     revmeta.py-20080901215045-n8a6arqybs9ez5hl-1
=== modified file 'branchprops.py'
--- a/branchprops.py	2008-11-12 10:24:38 +0000
+++ b/branchprops.py	2008-12-01 03:57:35 +0000
@@ -52,8 +52,7 @@
 
     def _real_get_properties(self, path, revnum):
         try:
-            (_, _, props) = self.log._transport.get_dir(path, 
-                revnum)
+            (_, _, props) = self.log._transport.get_dir(path, revnum)
         except SubversionException, (_, num):
             if num == ERR_FS_NO_SUCH_REVISION:
                 raise NoSuchRevision(self, revnum)

=== modified file 'fetch.py'
--- a/fetch.py	2008-12-01 03:37:27 +0000
+++ b/fetch.py	2008-12-01 03:57:35 +0000
@@ -178,6 +178,13 @@
         self.path = path
 
     def close(self):
+        if self.path == "":
+            # If it has changed, it has definitely been reported by now
+            if not self.editor.revmeta.knows_fileprops():
+                if self.editor.revmeta._fileprops.dict is None:
+                    self.editor.revmeta._fileprops.dict = dict(self.editor.revmeta.get_previous_fileprops())
+                self.editor.revmeta._fileprops.is_loaded = True
+                self.editor.revmeta._fileprops.create_fn = None
         self._close()
 
     def add_directory(self, path, copyfrom_path=None, copyfrom_revnum=-1):
@@ -192,6 +199,14 @@
         return self._open_directory(path, base_revnum)
 
     def change_prop(self, name, value):
+        if self.path == "":
+            # Replay lazy_dict, since it may be more expensive
+            if not self.editor.revmeta.knows_fileprops():
+                self.editor.revmeta._fileprops.dict = dict(self.editor.revmeta.get_previous_fileprops())
+                self.editor.revmeta._fileprops.is_loaded = True
+                self.editor.revmeta._fileprops.create_fn = None
+            self.editor.revmeta._fileprops.dict[name] = value
+
         if name in (properties.PROP_ENTRY_COMMITTED_DATE,
                     properties.PROP_ENTRY_COMMITTED_REV,
                     properties.PROP_ENTRY_LAST_AUTHOR,

=== modified file 'revmeta.py'
--- a/revmeta.py	2008-12-01 03:37:27 +0000
+++ b/revmeta.py	2008-12-01 03:57:35 +0000
@@ -180,7 +180,10 @@
         """Get the file properties set on the branch root.
         """
         if self._fileprops is None:
-            self._fileprops = self._get_fileprops_fn(self.branch_path, self.revnum)
+            if self.changes_branch_root():
+                self._fileprops = self._get_fileprops_fn(self.branch_path, self.revnum)
+            else:
+                self._fileprops = self.get_direct_lhs_parent_revmeta().get_fileprops()
         return self._fileprops
 
     def get_revprops(self):




More information about the bazaar-commits mailing list