Rev 2778: Merge bzr.dev. in http://people.ubuntu.com/~robertc/baz2.0/repository
Robert Collins
robertc at robertcollins.net
Mon Sep 24 06:54:50 BST 2007
At http://people.ubuntu.com/~robertc/baz2.0/repository
------------------------------------------------------------
revno: 2778
revision-id: robertc at robertcollins.net-20070924055425-ihuk0s7nfwxqi2wn
parent: robertc at robertcollins.net-20070923224332-qy28l0g345rcyein
parent: pqm at pqm.ubuntu.com-20070924042807-nfjwj1voh6a8zddf
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository
timestamp: Mon 2007-09-24 15:54:25 +1000
message:
Merge bzr.dev.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/knit.py knit.py-20051212171256-f056ac8f0fbe1bd9
bzrlib/tests/test_knit.py test_knit.py-20051212171302-95d4c00dd5f11f2b
------------------------------------------------------------
revno: 2592.1.25.2.7.1.28.1.6.1.3.1.9.2.1.3.74.1.31.3.18.1.9.1.2.1.12.1.8.1.26
revision-id: pqm at pqm.ubuntu.com-20070924042807-nfjwj1voh6a8zddf
parent: pqm at pqm.ubuntu.com-20070923210826-t3ymvo1l68z96in1
parent: robertc at robertcollins.net-20070924022944-lv2e2glumuo3ne8q
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2007-09-24 05:28:07 +0100
message:
(robertc) Increase efficiency of shaing during adding of knit records. (Robert Collins)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/knit.py knit.py-20051212171256-f056ac8f0fbe1bd9
bzrlib/tests/test_knit.py test_knit.py-20051212171302-95d4c00dd5f11f2b
------------------------------------------------------------
revno: 2592.1.25.2.7.1.28.1.6.1.3.1.9.2.1.3.74.1.31.3.18.1.9.1.2.1.12.1.8.1.25.1.1
revision-id: robertc at robertcollins.net-20070924022944-lv2e2glumuo3ne8q
parent: pqm at pqm.ubuntu.com-20070923210826-t3ymvo1l68z96in1
committer: Robert Collins <robertc at robertcollins.net>
branch nick: knits
timestamp: Mon 2007-09-24 12:29:44 +1000
message:
* ``KnitVersionedFile.add*`` will no longer cache added records even when
enable_cache() has been called - the caching feature is now exclusively for
reading existing data. (Robert Collins)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/knit.py knit.py-20051212171256-f056ac8f0fbe1bd9
bzrlib/tests/test_knit.py test_knit.py-20051212171302-95d4c00dd5f11f2b
------------------------------------------------------------
revno: 2592.1.25.2.7.1.28.1.6.1.3.1.9.2.1.3.74.1.31.3.18.1.9.1.2.1.12.1.8.1.25
revision-id: pqm at pqm.ubuntu.com-20070923210826-t3ymvo1l68z96in1
parent: pqm at pqm.ubuntu.com-20070923202533-vzfy37j7bpkwo21z
parent: robertc at robertcollins.net-20070923203327-o2pztijk7aysuw9w
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sun 2007-09-23 22:08:26 +0100
message:
(robertc) Tweak index -Devil tracing.
modified:
bzrlib/index.py index.py-20070712131115-lolkarso50vjr64s-1
------------------------------------------------------------
revno: 2592.1.25.2.7.1.28.1.6.1.3.1.9.2.1.3.74.1.31.3.18.1.9.1.2.1.12.1.8.1.24.1.1
revision-id: robertc at robertcollins.net-20070923203327-o2pztijk7aysuw9w
parent: pqm at pqm.ubuntu.com-20070923202533-vzfy37j7bpkwo21z
committer: Robert Collins <robertc at robertcollins.net>
branch nick: index
timestamp: Mon 2007-09-24 06:33:27 +1000
message:
Tweak index -Devil tracing.
modified:
bzrlib/index.py index.py-20070712131115-lolkarso50vjr64s-1
=== modified file 'NEWS'
--- a/NEWS 2007-09-23 20:29:13 +0000
+++ b/NEWS 2007-09-24 05:54:25 +0000
@@ -91,6 +91,10 @@
API BREAKS:
+ * ``KnitVersionedFile.add*`` will no longer cache added records even when
+ enable_cache() has been called - the caching feature is now exclusively for
+ reading existing data. (Robert Collins)
+
* The ``VersionedFile`` interface now allows content checks to be bypassed
by supplying check_content=False. This saves nearly 30% of the minimum
cost to store a version of a file. (Robert Collins)
=== modified file 'bzrlib/knit.py'
--- a/bzrlib/knit.py 2007-09-23 20:29:13 +0000
+++ b/bzrlib/knit.py 2007-09-24 05:54:25 +0000
@@ -104,6 +104,7 @@
from bzrlib.osutils import (
contains_whitespace,
contains_linebreaks,
+ sha_string,
sha_strings,
)
from bzrlib.symbol_versioning import DEPRECATED_PARAMETER, deprecated_passed
@@ -849,17 +850,12 @@
Any versions not present will be converted into ghosts.
"""
- # 461 0 6546.0390 43.9100 bzrlib.knit:489(_add)
- # +400 0 889.4890 418.9790 +bzrlib.knit:192(lower_fulltext)
- # +461 0 1364.8070 108.8030 +bzrlib.knit:996(add_record)
- # +461 0 193.3940 41.5720 +bzrlib.knit:898(add_version)
- # +461 0 134.0590 18.3810 +bzrlib.osutils:361(sha_strings)
- # +461 0 36.3420 15.4540 +bzrlib.knit:146(make)
- # +1383 0 8.0370 8.0370 +<len>
- # +61 0 13.5770 7.9190 +bzrlib.knit:199(lower_line_delta)
- # +61 0 963.3470 7.8740 +bzrlib.knit:427(_get_content)
- # +61 0 973.9950 5.2950 +bzrlib.knit:136(line_delta)
- # +61 0 1918.1800 5.2640 +bzrlib.knit:359(_merge_annotations)
+ # first thing, if the content is something we don't need to store, find
+ # that out.
+ line_bytes = ''.join(lines)
+ digest = sha_string(line_bytes)
+ if nostore_sha == digest:
+ raise errors.ExistingContent
present_parents = []
if parent_texts is None:
@@ -874,10 +870,7 @@
present_parents[0] != parents[0])):
delta = False
- digest = sha_strings(lines)
- if nostore_sha == digest:
- raise errors.ExistingContent
- text_length = sum(map(len, lines))
+ text_length = len(line_bytes)
options = []
if lines:
if lines[-1][-1] != '\n':
@@ -903,13 +896,20 @@
if delta:
options.append('line-delta')
store_lines = self.factory.lower_line_delta(delta_hunks)
+ size, bytes = self._data._record_to_data(version_id, digest,
+ store_lines)
else:
options.append('fulltext')
+ # get mixed annotation + content and feed it into the
+ # serialiser.
store_lines = self.factory.lower_fulltext(content)
+ size, bytes = self._data._record_to_data(version_id, digest,
+ store_lines)
- access_memo = self._data.add_record(version_id, digest, store_lines)
+ access_memo = self._data.add_raw_records([size], bytes)[0]
self._index.add_versions(
- ((version_id, options, access_memo, parents),), random_id=random_id)
+ ((version_id, options, access_memo, parents),),
+ random_id=random_id)
return digest, text_length, content
def check(self, progress_bar=None):
@@ -2003,17 +2003,6 @@
"""
return self._access.add_raw_records(sizes, raw_data)
- def add_record(self, version_id, digest, lines):
- """Write new text record to disk.
-
- Returns index data for retrieving it later, as per add_raw_records.
- """
- size, bytes = self._record_to_data(version_id, digest, lines)
- result = self.add_raw_records([size], bytes)
- if self._do_cache:
- self._cache[version_id] = bytes
- return result[0]
-
def _parse_record_header(self, version_id, raw_data):
"""Parse a record header for consistency.
=== modified file 'bzrlib/tests/test_knit.py'
--- a/bzrlib/tests/test_knit.py 2007-09-23 20:29:13 +0000
+++ b/bzrlib/tests/test_knit.py 2007-09-24 05:54:25 +0000
@@ -1907,11 +1907,8 @@
class TestKnitCaching(KnitTests):
- def create_knit(self, cache_add=False):
+ def create_knit(self):
k = self.make_test_knit(True)
- if cache_add:
- k.enable_cache()
-
k.add_lines('text-1', [], split_lines(TEXT_1))
k.add_lines('text-2', [], split_lines(TEXT_2))
return k
@@ -1921,14 +1918,6 @@
# Nothing should be cached without setting 'enable_cache'
self.assertEqual({}, k._data._cache)
- def test_cache_add_and_clear(self):
- k = self.create_knit(True)
-
- self.assertEqual(['text-1', 'text-2'], sorted(k._data._cache.keys()))
-
- k.clear_cache()
- self.assertEqual({}, k._data._cache)
-
def test_cache_data_read_raw(self):
k = self.create_knit()
More information about the bazaar-commits
mailing list