Rev 2486: Don't decode the path entry until we've actually decided to return the tuple. in http://bazaar.launchpad.net/%7Ebzr/bzr/dirstate
John Arbash Meinel
john at arbash-meinel.com
Thu Mar 1 15:55:20 GMT 2007
At http://bazaar.launchpad.net/%7Ebzr/bzr/dirstate
------------------------------------------------------------
revno: 2486
revision-id: john at arbash-meinel.com-20070301155418-ocyly7icb2tyhvvu
parent: robertc at robertcollins.net-20070301122044-x7c1rh865qdv3pnb
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dirstate
timestamp: Thu 2007-03-01 09:54:18 -0600
message:
Don't decode the path entry until we've actually decided to return the tuple.
This saves somewhere between 500 - 1000ms on the Moz tree.
It will be more noticable when we don't do the extra directory walking
(where we have to decode all of the path names again).
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-03-01 11:16:53 +0000
+++ b/bzrlib/workingtree_4.py 2007-03-01 15:54:18 +0000
@@ -1575,6 +1575,9 @@
:param path_info: top_relpath, basename, kind, lstat, abspath for
the path of entry. If None, then the path is considered absent.
(Perhaps we should pass in a concrete entry for this ?)
+ Basename is returned as a utf8 string because we expect this
+ tuple will be ignored, and don't want to take the time to
+ decode.
"""
# TODO: when a parent has been renamed, dont emit path renames for children,
if source_index is None:
@@ -1686,8 +1689,8 @@
last_target_parent[2] = target_parent_entry
source_exec = source_details[3]
- path_unicode = utf8_decode(path)[0]
- return ((entry[0][2], path_unicode, content_change,
+ #path_unicode = utf8_decode(path)[0]
+ return ((entry[0][2], path, content_change,
(True, True),
(source_parent_id, target_parent_id),
(old_basename, entry[0][1]),
@@ -1706,8 +1709,8 @@
new_executable = bool(
stat.S_ISREG(path_info[3].st_mode)
and stat.S_IEXEC & path_info[3].st_mode)
- path_unicode = utf8_decode(path)[0]
- return ((entry[0][2], path_unicode, True,
+ #path_unicode = utf8_decode(path)[0]
+ return ((entry[0][2], path, True,
(False, True),
(None, parent_id),
(None, entry[0][1]),
@@ -1727,8 +1730,8 @@
parent_id = state._get_entry(source_index, path_utf8=entry[0][0])[0][2]
if parent_id == entry[0][2]:
parent_id = None
- old_path_unicode = utf8_decode(old_path)[0]
- return ((entry[0][2], old_path_unicode, True,
+ #old_path_unicode = utf8_decode(old_path)[0]
+ return ((entry[0][2], old_path, True,
(True, False),
(parent_id, None),
(entry[0][1], None),
@@ -1787,6 +1790,8 @@
or result[6][0] != result[6][1] # kind
or result[7][0] != result[7][1] # executable
):
+ result = (result[0],
+ _utf8_decode(result[1])[0]) + result[2:]
yield result
dir_iterator = osutils._walkdirs_utf8(root_abspath, prefix=current_root)
initial_key = (current_root, '', '')
@@ -1862,6 +1867,8 @@
or result[6][0] != result[6][1] # kind
or result[7][0] != result[7][1] # executable
):
+ result = (result[0],
+ _utf8_decode(result[1])[0]) + result[2:]
yield result
block_index +=1
if (block_index < len(state._dirblocks) and
@@ -1915,6 +1922,8 @@
or result[6][0] != result[6][1] # kind
or result[7][0] != result[7][1] # executable
):
+ result = (result[0],
+ _utf8_decode(result[1])[0]) + result[2:]
yield result
elif current_entry[0][1] != current_path_info[1]:
if current_path_info[1] < current_entry[0][1]:
@@ -1938,6 +1947,8 @@
or result[6][0] != result[6][1] # kind
or result[7][0] != result[7][1] # executable
):
+ result = (result[0],
+ _utf8_decode(result[1])[0]) + result[2:]
yield result
advance_path = False
else:
@@ -1953,6 +1964,8 @@
or result[6][0] != result[6][1] # kind
or result[7][0] != result[7][1] # executable
):
+ result = (result[0],
+ _utf8_decode(result[1])[0]) + result[2:]
yield result
if advance_entry and current_entry is not None:
entry_index += 1
More information about the bazaar-commits
mailing list