[MERGE] Enable use of smart revision streaming between repos with compatible models.
Andrew Bennetts
andrew at canonical.com
Fri Jan 11 05:02:40 GMT 2008
This change relaxes the is_compatible check on InterRemoteToOther so that the
smart method for transferring revision data will be used for fetches between
model-compatible formats, not just between identical formats.
This also fixes one small bug revealed by this change, which is that the
reader_callable returned from one place didn't quite satisfy the contract
(that reader_callable(None) should return all the remaining bytes).
Finally, this also quietens the mutter that happens when the knit code notices
and copes with a stream from another format. Otherwise you get a .bzr.log with
lots of usually uninteresting mutters. At Robert's suggestion, that mutter now
happens only if you pass -Dknit (a new debug flag).
-Andrew.
-------------- next part --------------
# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: andrew.bennetts at canonical.com-20080111045553-\
# g8rfanwmvy2bchtp
# target_branch: http://bazaar-vcs.org/bzr/bzr.dev
# testament_sha1: a39da1a45087b6d60da46f62e568ce019d639ab6
# timestamp: 2008-01-11 15:56:21 +1100
# source_branch: http://people.ubuntu.com/~andrew/bzr/remote-fetch-\
# formats
# base_revision_id: pqm at pqm.ubuntu.com-20080110025628-6tl4b9cmdn335suw
#
# Begin patch
=== modified file 'NEWS'
--- NEWS 2008-01-10 01:45:17 +0000
+++ NEWS 2008-01-11 04:55:53 +0000
@@ -46,6 +46,9 @@
at the start of the file, promoting linear reads for ``bzr log`` and the
like. This partially fixes #154129. (Robert Collins)
+ * Fetching between different repository formats with compatible models now
+ takes advantage of the smart method to stream revisions. (Andrew Bennetts)
+
* Merge directives now fetch prerequisites from the target branch if
needed. (Aaron Bentley)
=== modified file 'bzrlib/debug.py'
--- bzrlib/debug.py 2008-01-09 07:04:23 +0000
+++ bzrlib/debug.py 2008-01-11 04:55:53 +0000
@@ -34,6 +34,7 @@
* hpss - trace smart protocol requests and responses
* http - trace http connections, requests and responses
* index - trace major index operations
+ * knit - trace knit operations
* lock - trace when lockdir locks are taken or released
* merge - emit information for debugging merges
* times - record timestamps from program start in trace file
=== modified file 'bzrlib/help_topics/__init__.py'
--- bzrlib/help_topics/__init__.py 2008-01-09 07:04:23 +0000
+++ bzrlib/help_topics/__init__.py 2008-01-11 04:55:53 +0000
@@ -287,6 +287,7 @@
-Dhpss Trace smart protocol requests and responses.
-Dhttp Trace http connections, requests and responses
-Dindex Trace major index operations.
+-Dknit Trace knit operations.
-Dlock Trace when lockdir locks are taken or released.
-Dmerge Emit information for debugging merges.
-Dtimes Record timestamps from program start in trace file.
=== modified file 'bzrlib/knit.py'
--- bzrlib/knit.py 2007-11-30 07:45:56 +0000
+++ bzrlib/knit.py 2008-01-11 04:55:53 +0000
@@ -736,7 +736,9 @@
:seealso: get_data_stream
"""
if format != self.get_format_signature():
- trace.mutter('incompatible format signature inserting to %r', self)
+ if 'knit' in debug.debug_flags:
+ trace.mutter(
+ 'incompatible format signature inserting to %r', self)
source = self._knit_from_datastream(
(format, data_list, reader_callable))
self.join(source)
=== modified file 'bzrlib/repository.py'
--- bzrlib/repository.py 2008-01-10 01:30:10 +0000
+++ bzrlib/repository.py 2008-01-11 04:55:53 +0000
@@ -842,8 +842,14 @@
for version, options, parents, some_bytes in decoded_list:
data_list.append((version, options, len(some_bytes), parents))
knit_bytes += some_bytes
+ buffer = StringIO(knit_bytes)
+ def reader_func(count):
+ if count is None:
+ return buffer.read()
+ else:
+ return buffer.read(count)
knit.insert_data_stream(
- (format, data_list, StringIO(knit_bytes).read))
+ (format, data_list, reader_func))
@needs_read_lock
def missing_revision_ids(self, other, revision_id=None, find_ghosts=True):
@@ -2823,14 +2829,12 @@
def is_compatible(source, target):
if not isinstance(source, remote.RemoteRepository):
return False
+ # Is source's model compatible with target's model?
source._ensure_real()
real_source = source._real_repository
- # Is source's model compatible with target's model, and are they the
- # same format? Currently we can only optimise fetching from an
- # identical model & format repo.
assert not isinstance(real_source, remote.RemoteRepository), (
"We don't support remote repos backed by remote repos yet.")
- return real_source._format == target._format
+ return InterRepository._same_model(real_source, target)
@needs_write_lock
def fetch(self, revision_id=None, pb=None, find_ghosts=False):
=== modified file 'bzrlib/tests/test_osutils.py'
--- bzrlib/tests/test_osutils.py 2008-01-09 23:21:45 +0000
+++ bzrlib/tests/test_osutils.py 2008-01-11 04:55:53 +0000
@@ -1114,6 +1114,7 @@
* hpss - trace smart protocol requests and responses
* http - trace http connections, requests and responses
* index - trace major index operations
+ * knit - trace knit operations
* lock - trace when lockdir locks are taken or released
* merge - emit information for debugging merges
* times - record timestamps from program start in trace file
# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWXvukxkABVx/gGZUQABb////
////wL////BgCe+etSAAAAGYwAAKAACGSBTIp7Kek9U3onqfqNMU1PRqeieaKeppo0HqDQAzU00x
w0MmmhpkaGmRkGRkaGQGJoyaAMmRiGOGhk00NMjQ0yMgyMjQyAxNGTQBkyMQwzUlJptRk00GgNAA
BoBkaAAABoAOGhk00NMjQ0yMgyMjQyAxNGTQBkyMQwkkAgE00AmmjTQTTQnqanojZNMiNB6nomh6
mNSYSg2yZFzo9MCT4ax2IMkL2MvMUEH6/Zh6+PxBK7XcwZFze7uOpiEFd+Tr0yTJ7eGiXe2u+3Cn
Mq0KjAicUzD7MB7WbJDp7C10H0NDfHcgFJfJkjc/bu3PwqdMoZrfgnepiBMAQAwVv1acrc+JjAFd
mLKKsXGs1vgRNbE2H2DipggxKrXzze+JQZzBXV8uk89ePLswJ7g3aamr/kyQmgduLUwdgNrtcujv
Dt2xrYBKFlUYUIFGCyECK1RRdKyKgBDqjAnCnbTNPGsFNh2H0FfvuBT31V41YulkVQc5JiKfvWoO
3Q5wYFtU6JuWoEqXSsknXnoSjH0LvsZxMCZ+hf2y4YJ01d7NnBcdbM6nJm3qwXBAF+K9S6Owb/zH
FdRZyEc17J4wkS6l1mQW9aMfCIg83a46YOedk6y8fs0Thj5EkdCP2BhB4ZpEtMP1hEYgMQMTUG9L
/vhTVY4T1+IMzadOp1QLcyDQwMNFkGrfsc+f2PQQYcIJskKRaP3pCgQlKI43ERiA4elRMUPO+0C1
XFBByIwKAqrD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