Rev 4966: (mbp) merge 2.0 back to trunk in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Jan 15 07:36:13 GMT 2010
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4966 [merge]
revision-id: pqm at pqm.ubuntu.com-20100115073610-fhh709ihgalxy9b8
parent: pqm at pqm.ubuntu.com-20100115054342-o6ar5y4ch9tcnzyi
parent: mbp at sourcefrog.net-20100115070049-0cb4bi4lsrul2szs
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2010-01-15 07:36:10 +0000
message:
(mbp) merge 2.0 back to trunk
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/smart/repository.py repository.py-20061128022038-vr5wy5bubyb8xttk-1
bzrlib/tests/blackbox/test_pull.py test_pull.py-20051201144907-64959364f629947f
bzrlib/ui/__init__.py ui.py-20050824083933-8cf663c763ba53a9
=== modified file 'NEWS'
--- a/NEWS 2010-01-15 04:53:03 +0000
+++ b/NEWS 2010-01-15 07:36:10 +0000
@@ -242,10 +242,10 @@
* Give a clearer message if the lockdir disappears after being apparently
successfully taken. (Martin Pool, #498378)
-* Give a warning when fetching between local repositories with
+* Give a warning when fetching between repositories (local or remote) with
sufficiently different formats that the content will need to be
- serialized (ie ``InterDifferingSerializer``) so the user has a clue that
- upgrading could make it faster.
+ serialized (ie ``InterDifferingSerializer`` or ``inventory-deltas``), so
+ the user has a clue that upgrading could make it faster.
(Martin Pool, #456077)
* If we fail to open ``~/.bzr.log`` write a clear message to stderr rather
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2010-01-13 23:06:42 +0000
+++ b/bzrlib/repository.py 2010-01-15 07:00:49 +0000
@@ -4013,11 +4013,8 @@
#
# nb this is only active for local-local fetches; other things using
# streaming.
- trace.warning("Fetching between repositories with different formats\n"
- "from %s to %s.\n"
- "This may take some time. Upgrade the branches to the same format \n"
- "for better results.\n"
- % (self.source._format, self.target._format))
+ ui.ui_factory.warn_cross_format_fetch(self.source._format,
+ self.target._format)
if (not self.source.supports_rich_root()
and self.target.supports_rich_root()):
self._converting_to_rich_root = True
@@ -4316,6 +4313,8 @@
self._extract_and_insert_inventories(
substream, src_serializer)
elif substream_type == 'inventory-deltas':
+ ui.ui_factory.warn_cross_format_fetch(src_format,
+ self.target_repo._format)
self._extract_and_insert_inventory_deltas(
substream, src_serializer)
elif substream_type == 'chk_bytes':
@@ -4626,8 +4625,10 @@
def _get_convertable_inventory_stream(self, revision_ids,
delta_versus_null=False):
- # The source is using CHKs, but the target either doesn't or it has a
- # different serializer. The StreamSink code expects to be able to
+ # The two formats are sufficiently different that there is no fast
+ # path, so we need to send just inventorydeltas, which any
+ # sufficiently modern client can insert into any repository.
+ # The StreamSink code expects to be able to
# convert on the target, so we need to put bytes-on-the-wire that can
# be converted. That means inventory deltas (if the remote is <1.19,
# RemoteStreamSink will fallback to VFS to insert the deltas).
=== modified file 'bzrlib/smart/repository.py'
--- a/bzrlib/smart/repository.py 2009-09-03 00:33:35 +0000
+++ b/bzrlib/smart/repository.py 2010-01-14 07:34:37 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006, 2007 Canonical Ltd
+# Copyright (C) 2006, 2007, 2010 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,6 +30,7 @@
graph,
osutils,
pack,
+ ui,
versionedfile,
)
from bzrlib.bzrdir import BzrDir
@@ -502,6 +503,13 @@
yield pack_writer.begin()
yield pack_writer.bytes_record(src_format.network_name(), '')
for substream_type, substream in stream:
+ if substream_type == 'inventory-deltas':
+ # This doesn't feel like the ideal place to issue this warning;
+ # however we don't want to do it in the Repository that's
+ # generating the stream, because that might be on the server.
+ # Instead we try to observe it as the stream goes by.
+ ui.ui_factory.warn_cross_format_fetch(src_format,
+ '(remote)')
for record in substream:
if record.storage_kind in ('chunked', 'fulltext'):
serialised = record_to_fulltext_bytes(record)
=== modified file 'bzrlib/tests/blackbox/test_pull.py'
--- a/bzrlib/tests/blackbox/test_pull.py 2010-01-13 16:27:22 +0000
+++ b/bzrlib/tests/blackbox/test_pull.py 2010-01-15 03:34:28 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005-2010 Canonical Ltd
+# Copyright (C) 2005, 2006, 2010 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,13 +20,18 @@
import os
import sys
+from bzrlib import (
+ debug,
+ remote,
+ urlutils,
+ )
+
from bzrlib.branch import Branch
from bzrlib.directory_service import directories
from bzrlib.osutils import pathjoin
from bzrlib.tests.blackbox import ExternalBase
from bzrlib.uncommit import uncommit
from bzrlib.workingtree import WorkingTree
-from bzrlib import urlutils
class TestPull(ExternalBase):
@@ -394,10 +399,37 @@
def test_pull_cross_format_warning(self):
"""You get a warning for probably slow cross-format pulls.
"""
-
- from_tree = self.make_branch_and_tree('from', format='2a')
- to_tree = self.make_branch_and_tree('to', format='1.14-rich-root')
- from_tree.commit(message='first commit')
- out, err = self.run_bzr(['pull', '-d', 'to', 'from'])
- self.assertContainsRe(err,
- "(?m)Fetching between repositories with different formats.*")
+ # this is assumed to be going through InterDifferingSerializer
+ from_tree = self.make_branch_and_tree('from', format='2a')
+ to_tree = self.make_branch_and_tree('to', format='1.14-rich-root')
+ from_tree.commit(message='first commit')
+ out, err = self.run_bzr(['pull', '-d', 'to', 'from'])
+ self.assertContainsRe(err,
+ "(?m)Doing on-the-fly conversion")
+
+ def test_pull_cross_format_warning_no_IDS(self):
+ """You get a warning for probably slow cross-format pulls.
+ """
+ # this simulates what would happen across the network, where
+ # interdifferingserializer is not active
+
+ debug.debug_flags.add('IDS_never')
+ # TestCase take care of restoring them
+
+ from_tree = self.make_branch_and_tree('from', format='2a')
+ to_tree = self.make_branch_and_tree('to', format='1.14-rich-root')
+ from_tree.commit(message='first commit')
+ out, err = self.run_bzr(['pull', '-d', 'to', 'from'])
+ self.assertContainsRe(err,
+ "(?m)Doing on-the-fly conversion")
+
+ def test_pull_cross_format_from_network(self):
+ self.setup_smart_server_with_call_log()
+ from_tree = self.make_branch_and_tree('from', format='2a')
+ to_tree = self.make_branch_and_tree('to', format='1.14-rich-root')
+ self.assertIsInstance(from_tree.branch, remote.RemoteBranch)
+ from_tree.commit(message='first commit')
+ out, err = self.run_bzr(['pull', '-d', 'to',
+ from_tree.branch.bzrdir.root_transport.base])
+ self.assertContainsRe(err,
+ "(?m)Doing on-the-fly conversion")
=== modified file 'bzrlib/ui/__init__.py'
--- a/bzrlib/ui/__init__.py 2010-01-14 08:20:18 +0000
+++ b/bzrlib/ui/__init__.py 2010-01-15 07:00:49 +0000
@@ -263,7 +263,7 @@
"""Show an error message (not an exception) to the user.
The message should not have an error prefix or trailing newline. That
- will be added by the factory if appropriate.
+ will be added by the factory if appropriate.
"""
raise NotImplementedError(self.show_error)
@@ -275,6 +275,13 @@
"""Show a warning to the user."""
raise NotImplementedError(self.show_warning)
+ def warn_cross_format_fetch(self, from_format, to_format):
+ """Warn about a potentially slow cross-format transfer"""
+ # See <https://launchpad.net/bugs/456077> asking for a warning here
+ trace.warning("Doing on-the-fly conversion from %s to %s.\n"
+ "This may take some time. Upgrade the repositories to the "
+ "same format for better performance.\n" %
+ (from_format, to_format))
class SilentUIFactory(UIFactory):
More information about the bazaar-commits
mailing list