Rev 2371: hack in a faster id2path, ultimately we want something different. in http://bazaar.launchpad.net/%7Ebzr/bzr/dirstate

John Arbash Meinel john at arbash-meinel.com
Thu Feb 22 23:27:20 GMT 2007


At http://bazaar.launchpad.net/%7Ebzr/bzr/dirstate

------------------------------------------------------------
revno: 2371
revision-id: john at arbash-meinel.com-20070222232615-46n3rjdpfrsbmu3b
parent: john at arbash-meinel.com-20070222202320-k3x9ozxjj2ugnygc
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dirstate
timestamp: Thu 2007-02-22 17:26:15 -0600
message:
  hack in a faster id2path, ultimately we want something different.
modified:
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
-------------- next part --------------
=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2007-02-22 20:23:20 +0000
+++ b/bzrlib/workingtree_4.py	2007-02-22 23:26:15 +0000
@@ -340,10 +340,17 @@
 
     @needs_read_lock
     def id2path(self, fileid):
-        state = self.current_dirstate()
         fileid = osutils.safe_file_id(fileid)
-        key, tree_details = state._get_entry(0, fileid_utf8=fileid)
-        return os.path.join(*key[0:2]).decode('utf8')
+        inv = self._get_inventory()
+        return inv.id2path(fileid)
+        # TODO: jam 20070222 At present dirstate is very slow at id => path,
+        #       while inventory is very fast at it. So for now, just generate
+        #       the inventory and do the id => path check.
+        #       In the future, we want to make dirstate better at id=>path
+        #       checks so that we don't have to create the inventory.
+        # state = self.current_dirstate()
+        # key, tree_details = state._get_entry(0, fileid_utf8=fileid)
+        # return os.path.join(*key[0:2]).decode('utf8')
 
     @needs_read_lock
     def __iter__(self):



More information about the bazaar-commits mailing list