Rev 2266: Change bzrlib so that it uses the new HybridLinkedList. in http://bzr.arbash-meinel.com/branches/bzr/0.15-dev/list_patch
John Arbash Meinel
john at arbash-meinel.com
Wed Jan 31 00:28:57 GMT 2007
At http://bzr.arbash-meinel.com/branches/bzr/0.15-dev/list_patch
------------------------------------------------------------
revno: 2266
revision-id: john at arbash-meinel.com-20070131002851-1ieso3qfka7sqmoa
parent: john at arbash-meinel.com-20070131002829-8q0r5zqy24y11ng7
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: list_patch
timestamp: Tue 2007-01-30 18:28:51 -0600
message:
Change bzrlib so that it uses the new HybridLinkedList.
modified:
bzrlib/knit.py knit.py-20051212171256-f056ac8f0fbe1bd9
bzrlib/versionedfile.py versionedfile.py-20060222045106-5039c71ee3b65490
-------------- next part --------------
=== modified file 'bzrlib/knit.py'
--- a/bzrlib/knit.py 2007-01-17 15:37:08 +0000
+++ b/bzrlib/knit.py 2007-01-31 00:28:51 +0000
@@ -73,6 +73,7 @@
from bzrlib import (
cache_utf8,
errors,
+ hybrid_linked_list,
patiencediff,
progress,
ui,
@@ -122,7 +123,7 @@
"""Content of a knit version to which deltas can be applied."""
def __init__(self, lines):
- self._lines = lines
+ self._lines = hybrid_linked_list.HybridLinkedList(lines)
def annotate_iter(self):
"""Yield tuples of (origin, text) for each content line."""
@@ -150,7 +151,9 @@
return [text for origin, text in self._lines]
def copy(self):
- return KnitContent(self._lines[:])
+ content = KnitContent([])
+ content._lines = self._lines.copy()
+ return content
class _KnitFactory(object):
@@ -606,6 +609,13 @@
# content for any line that matches the last-checked parent.
# FIXME: save the sequence control data for delta compression
# against the most relevant parent rather than rediffing.
+ # TODO: jam 20070130 We could actually do this by sending
+ # the complete content over and just using a specific
+ # range, rather than having to extract a slice from
+ # merge_content._lines[]. Consider doing that.
+ # But it starts getting ugly if merge_content._lines
+ # is also a bunch of delta hunks. So this may be the
+ # cleanest overall.
content._lines[j:j+n] = merge_content._lines[i:i+n]
if delta:
if not annotated:
=== modified file 'bzrlib/versionedfile.py'
--- a/bzrlib/versionedfile.py 2007-01-17 15:37:08 +0000
+++ b/bzrlib/versionedfile.py 2007-01-31 00:28:51 +0000
@@ -387,7 +387,6 @@
def _apply_delta(self, lines, delta):
"""Apply delta to lines."""
- lines = list(lines)
offset = 0
for start, end, count, delta_lines in delta:
lines[offset+start:offset+end] = delta_lines
More information about the bazaar-commits
mailing list