Rev 2159: Add hack to avoid expensive lookup by parent_id and basename. in http://people.samba.org/bzr/jelmer/bzr-svn/0.5

Jelmer Vernooij jelmer at samba.org
Thu Dec 4 21:05:09 GMT 2008


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

------------------------------------------------------------
revno: 2159
revision-id: jelmer at samba.org-20081204210507-x9gg7n9np8x1me0c
parent: jelmer at samba.org-20081204205252-anocnnwco3dfo9kq
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.5
timestamp: Thu 2008-12-04 22:05:07 +0100
message:
  Add hack to avoid expensive lookup by parent_id and basename.
modified:
  AUTHORS                        AUTHORS-20060508114718-4c90c0062645106d
  fetch.py                       fetch.py-20060625004942-x2lfaib8ra707a8p-1
=== modified file 'AUTHORS'
--- a/AUTHORS	2008-11-12 09:40:22 +0000
+++ b/AUTHORS	2008-12-04 21:05:07 +0000
@@ -30,6 +30,7 @@
 Matthias Klose
 Jan Kneschke
 Lukás Lalinský
+Wesley Landaker
 Kevin Light
 Roland Mas
 John Arbash Meinel

=== modified file 'fetch.py'
--- a/fetch.py	2008-12-04 20:05:11 +0000
+++ b/fetch.py	2008-12-04 21:05:07 +0000
@@ -549,7 +549,12 @@
         assert isinstance(old_path, unicode)
         assert isinstance(parent_id, str)
         basename = urlutils.basename(old_path)
-        return self.old_inventory[parent_id].children[basename].file_id
+        parent_id_basename_index = getattr(self.old_inventory, "parent_id_basename_to_file_id", None)
+        if parent_id_basename_index is None:
+            return self.old_inventory[parent_id].children[basename].file_id
+        else:
+            ret = parent_id_basename_index.iteritems([(parent_id, basename)])
+            return ret.next()[1]
 
     def _get_existing_id(self, old_parent_id, new_parent_id, path):
         assert isinstance(path, unicode)




More information about the bazaar-commits mailing list