Rev 2320: override path2id because it should be optimized anyway in http://bazaar.launchpad.net/%7Ebzr/bzr/dirstate
John Arbash Meinel
john at arbash-meinel.com
Thu Feb 15 20:25:50 GMT 2007
At http://bazaar.launchpad.net/%7Ebzr/bzr/dirstate
------------------------------------------------------------
revno: 2320
revision-id: john at arbash-meinel.com-20070215202429-gouwaqj9541v25wf
parent: john at arbash-meinel.com-20070215193713-z5sdz6594q7isee0
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dirstate
timestamp: Thu 2007-02-15 14:24:29 -0600
message:
override path2id because it should be optimized anyway
and fix some double encoding and missed encoding bugs
now \.tree_implementations.*test_test all passes
modified:
bzrlib/dirstate.py dirstate.py-20060728012006-d6mvoihjb3je9peu-1
bzrlib/workingtree_4.py workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
-------------- next part --------------
=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py 2007-02-15 10:08:15 +0000
+++ b/bzrlib/dirstate.py 2007-02-15 20:24:29 +0000
@@ -426,11 +426,13 @@
def _get_ghosts_line(self, ghost_ids):
"""Create a line for the state file for ghost information."""
- return '\0'.join([str(len(ghost_ids))] + ghost_ids)
+ return '\0'.join([str(len(ghost_ids))] +
+ [g.encode('utf8') for g in ghost_ids])
def _get_parents_line(self, parent_ids):
"""Create a line for the state file for parents information."""
- return '\0'.join([str(len(parent_ids))] + parent_ids)
+ return '\0'.join([str(len(parent_ids))] +
+ [p.encode('utf8') for p in parent_ids])
def get_parent_ids(self):
"""Return a list of the parent tree ids for the directory state."""
@@ -528,7 +530,7 @@
return (parent_entry.revision.encode('utf8'),
parent_entry.kind,
# FIXME: set these from the parent
- dirname.encode('utf8'), basename.encode('utf8'),
+ dirname, basename,
parent_entry.text_size or 0,
parent_entry.executable,
parent_entry.text_sha1 or '',
=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py 2007-02-15 10:08:15 +0000
+++ b/bzrlib/workingtree_4.py 2007-02-15 20:24:29 +0000
@@ -907,6 +907,12 @@
"""Lock the tree for a set of operations."""
self._locked += 1
+ def path2id(self, path):
+ """Return the id for path in this tree."""
+ # TODO: jam 20070215 This should be heavily optimized for dirstate
+ # I'm taking the *very* lazy way out
+ return self._get_inventory().path2id(path)
+
def unlock(self):
"""Unlock, freeing any cache memory used during the lock."""
# outside of a lock, the inventory is suspect: release it.
More information about the bazaar-commits
mailing list