Rev 73: Uses chunks_to_lines rather than split_lines to deal with the output of iter_files_bytes. in http://people.canonical.com/~robertc/baz2.0/plugins/search/trunk
Robert Collins
robertc at robertcollins.net
Tue Nov 3 00:12:18 GMT 2009
At http://people.canonical.com/~robertc/baz2.0/plugins/search/trunk
------------------------------------------------------------
revno: 73
revision-id: robertc at robertcollins.net-20091103001213-cenznj24k2gwdu2j
parent: robertc at robertcollins.net-20090604021743-9bwgjekmd8ym4s3y
committer: Robert Collins <robertc at robertcollins.net>
branch nick: trunk
timestamp: Tue 2009-11-03 11:12:13 +1100
message:
Uses chunks_to_lines rather than split_lines to deal with the output of iter_files_bytes.
=== modified file 'index.py'
--- a/index.py 2009-06-03 21:44:06 +0000
+++ b/index.py 2009-11-03 00:12:13 +0000
@@ -34,7 +34,7 @@
from bzrlib.osutils import md5
except ImportError:
from md5 import new as md5
-from bzrlib.osutils import split_lines
+from bzrlib.osutils import chunks_to_lines
from bzrlib.pack import ContainerWriter
from bzrlib.plugins.search import errors
from bzrlib.plugins.search.inventory import paths_from_ids
@@ -824,9 +824,7 @@
"""Get a summary of the hit, for display to users."""
lines = self.repository.iter_files_bytes([
(self.text_key[0], self.text_key[1], "")]).next()[1]
- if not isinstance(lines, list):
- # We got bytes back, not lines (which the contract supports).
- lines = split_lines(lines)
+ lines = chunks_to_lines(lines)
# We could look for the best match, try to get context, line numbers
# etc. This is complex - what if 'foo' is on line 1 and 'bar' on line
# 54.
More information about the bazaar-commits
mailing list