Rev 3175: (andrew) Enable use of smart revision streaming between repos with in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Jan 11 07:06:45 GMT 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3175
revision-id:pqm at pqm.ubuntu.com-20080111070636-jhozu5eo7wvh1k0o
parent: pqm at pqm.ubuntu.com-20080111050820-eendmy6xgfc6w0yc
parent: andrew.bennetts at canonical.com-20080111045553-g8rfanwmvy2bchtp
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2008-01-11 07:06:36 +0000
message:
(andrew) Enable use of smart revision streaming between repos with
compatible models.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/debug.py debug.py-20061102062349-vdhrw9qdpck8cl35-1
bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
bzrlib/knit.py knit.py-20051212171256-f056ac8f0fbe1bd9
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/test_osutils.py test_osutils.py-20051201224856-e48ee24c12182989
------------------------------------------------------------
revno: 3172.2.1
revision-id:andrew.bennetts at canonical.com-20080111045553-g8rfanwmvy2bchtp
parent: pqm at pqm.ubuntu.com-20080110025628-6tl4b9cmdn335suw
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: remote-fetch-formats
timestamp: Fri 2008-01-11 15:55:53 +1100
message:
Enable use of smart revision streaming between repos with compatible models, not just between identical format repos.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/debug.py debug.py-20061102062349-vdhrw9qdpck8cl35-1
bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
bzrlib/knit.py knit.py-20051212171256-f056ac8f0fbe1bd9
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/test_osutils.py test_osutils.py-20051201224856-e48ee24c12182989
=== modified file 'NEWS'
--- a/NEWS 2008-01-11 05:08:20 +0000
+++ b/NEWS 2008-01-11 07:06:36 +0000
@@ -51,6 +51,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'
--- a/bzrlib/debug.py 2008-01-09 07:04:23 +0000
+++ b/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'
--- a/bzrlib/help_topics/__init__.py 2008-01-09 07:04:23 +0000
+++ b/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'
--- a/bzrlib/knit.py 2008-01-02 03:08:59 +0000
+++ b/bzrlib/knit.py 2008-01-11 07:06:36 +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'
--- a/bzrlib/repository.py 2008-01-11 05:08:20 +0000
+++ b/bzrlib/repository.py 2008-01-11 07:06:36 +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'
--- a/bzrlib/tests/test_osutils.py 2008-01-09 23:21:45 +0000
+++ b/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
More information about the bazaar-commits
mailing list