Rev 5118: (mbp) merge 2.1.1 back to trunk in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Mar 26 10:58:22 GMT 2010
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5118 [merge]
revision-id: pqm at pqm.ubuntu.com-20100326105820-ijo11554jb43sgzm
parent: pqm at pqm.ubuntu.com-20100326052532-9c9bbs1f7hmfr1j4
parent: mbp at canonical.com-20100326102547-74ta65m7w7ecjebq
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2010-03-26 10:58:20 +0000
message:
(mbp) merge 2.1.1 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_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
bzrlib/tests/test_ui.py test_ui.py-20051130162854-458e667a7414af09
bzrlib/ui/__init__.py ui.py-20050824083933-8cf663c763ba53a9
bzrlib/ui/text.py text.py-20051130153916-2e438cffc8afc478
bzrlib/upgrade.py history2weaves.py-20050818063535-e7d319791c19a8b2
doc/en/user-guide/stacked.txt stacked.txt-20080711023247-4uh9oovoka0sze8b-1
=== modified file 'NEWS'
--- a/NEWS 2010-03-26 04:47:45 +0000
+++ b/NEWS 2010-03-26 10:25:47 +0000
@@ -275,7 +275,10 @@
bzr 2.1.1
#########
-:2.1.1: not released yet
+:2.1.1: 2010-03-24
+
+This is a small bugfix release. Upgrading is recommended for anyone
+running 2.1.0 or earlier.
Bug Fixes
*********
@@ -309,7 +312,6 @@
``StaticTuple`` extensions, rather than having the build fail randomly.
(John Arbash Meinel, #449776)
-
Documentation
*************
@@ -710,6 +712,12 @@
a lock.
(Martin Pool, #185103)
+* Give the warning about potentially slow cross-format fetches much
+ earlier on in the fetch operation. Don't show this message during
+ upgrades, and show the correct format indication for remote
+ repositories.
+ (Martin Pool, #456077, #515356, #513157)
+
* Handle renames correctly when there are files or directories that
differ only in case. (Chris Jones, Martin Pool, #368931)
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2010-02-17 17:42:03 +0000
+++ b/bzrlib/repository.py 2010-03-26 10:25:47 +0000
@@ -3033,8 +3033,8 @@
# Is the format experimental ?
experimental = False
- def __str__(self):
- return "<%s>" % self.__class__.__name__
+ def __repr__(self):
+ return "%s()" % self.__class__.__name__
def __eq__(self, other):
# format objects are generally stateless
@@ -3372,7 +3372,13 @@
:return: None.
"""
ui.ui_factory.warn_experimental_format_fetch(self)
- f = _mod_fetch.RepoFetcher(to_repository=self.target,
+ from bzrlib.fetch import RepoFetcher
+ # See <https://launchpad.net/bugs/456077> asking for a warning here
+ if self.source._format.network_name() != self.target._format.network_name():
+ ui.ui_factory.show_user_warning('cross_format_fetch',
+ from_format=self.source._format,
+ to_format=self.target._format)
+ f = RepoFetcher(to_repository=self.target,
from_repository=self.source,
last_revision=revision_id,
fetch_spec=fetch_spec,
@@ -3956,12 +3962,6 @@
"""See InterRepository.fetch()."""
if fetch_spec is not None:
raise AssertionError("Not implemented yet...")
- # See <https://launchpad.net/bugs/456077> asking for a warning here
- #
- # nb this is only active for local-local fetches; other things using
- # streaming.
- ui.ui_factory.warn_cross_format_fetch(self.source._format,
- self.target._format)
ui.ui_factory.warn_experimental_format_fetch(self)
if (not self.source.supports_rich_root()
and self.target.supports_rich_root()):
@@ -3969,6 +3969,11 @@
self._revision_id_to_root_id = {}
else:
self._converting_to_rich_root = False
+ # See <https://launchpad.net/bugs/456077> asking for a warning here
+ if self.source._format.network_name() != self.target._format.network_name():
+ ui.ui_factory.show_user_warning('cross_format_fetch',
+ from_format=self.source._format,
+ to_format=self.target._format)
revision_ids = self.target.search_missing_revision_ids(self.source,
revision_id, find_ghosts=find_ghosts).get_keys()
if not revision_ids:
@@ -4257,8 +4262,6 @@
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':
=== modified file 'bzrlib/smart/repository.py'
--- a/bzrlib/smart/repository.py 2010-02-23 07:43:11 +0000
+++ b/bzrlib/smart/repository.py 2010-03-25 07:34:15 +0000
@@ -502,13 +502,6 @@
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_branch.py'
--- a/bzrlib/tests/blackbox/test_branch.py 2010-02-23 07:43:11 +0000
+++ b/bzrlib/tests/blackbox/test_branch.py 2010-03-25 07:34:15 +0000
@@ -325,6 +325,8 @@
' Packs 5 (adds stacking support, requires bzr 1.6)\n'
'Source branch format does not support stacking, using format:\n'
' Branch format 7\n'
+ 'Doing on-the-fly conversion from RepositoryFormatKnitPack1() to RepositoryFormatKnitPack5().\n'
+ 'This may take some time. Upgrade the repositories to the same format for better performance.\n'
'Created new stacked branch referring to %s.\n' % (trunk.base,),
err)
@@ -338,6 +340,8 @@
' Packs 5 rich-root (adds stacking support, requires bzr 1.6.1)\n'
'Source branch format does not support stacking, using format:\n'
' Branch format 7\n'
+ 'Doing on-the-fly conversion from RepositoryFormatKnitPack4() to RepositoryFormatKnitPack5RichRoot().\n'
+ 'This may take some time. Upgrade the repositories to the same format for better performance.\n'
'Created new stacked branch referring to %s.\n' % (trunk.base,),
err)
=== modified file 'bzrlib/tests/test_ui.py'
--- a/bzrlib/tests/test_ui.py 2010-02-23 07:43:11 +0000
+++ b/bzrlib/tests/test_ui.py 2010-03-25 07:34:15 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005-2010 Canonical Ltd
+# Copyright (C) 2005, 2008, 2009, 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
@@ -21,8 +21,12 @@
import re
import time
+from StringIO import StringIO
+
from bzrlib import (
errors,
+ remote,
+ repository,
tests,
ui as _mod_ui,
)
@@ -245,6 +249,32 @@
self.assertIsInstance(ui_factory._progress_view,
_mod_ui_text.NullProgressView)
+ def test_text_ui_show_user_warning(self):
+ from bzrlib.repofmt.groupcompress_repo import RepositoryFormat2a
+ from bzrlib.repofmt.pack_repo import RepositoryFormatKnitPack5
+ err = StringIO()
+ out = StringIO()
+ ui = tests.TextUIFactory(stdin=None, stdout=out, stderr=err)
+ remote_fmt = remote.RemoteRepositoryFormat()
+ remote_fmt._network_name = RepositoryFormatKnitPack5().network_name()
+ ui.show_user_warning('cross_format_fetch', from_format=RepositoryFormat2a(),
+ to_format=remote_fmt)
+ self.assertEquals('', out.getvalue())
+ self.assertEquals("Doing on-the-fly conversion from RepositoryFormat2a() to "
+ "RemoteRepositoryFormat(_network_name='Bazaar RepositoryFormatKnitPack5 "
+ "(bzr 1.6)\\n').\nThis may take some time. Upgrade the repositories to "
+ "the same format for better performance.\n",
+ err.getvalue())
+ # and now with it suppressed please
+ err = StringIO()
+ out = StringIO()
+ ui = tests.TextUIFactory(stdin=None, stdout=out, stderr=err)
+ ui.suppressed_warnings.add('cross_format_fetch')
+ ui.show_user_warning('cross_format_fetch', from_format=RepositoryFormat2a(),
+ to_format=remote_fmt)
+ self.assertEquals('', out.getvalue())
+ self.assertEquals('', err.getvalue())
+
class TestTextUIOutputStream(tests.TestCase):
"""Tests for output stream that synchronizes with progress bar."""
=== modified file 'bzrlib/ui/__init__.py'
--- a/bzrlib/ui/__init__.py 2010-02-10 18:29:50 +0000
+++ b/bzrlib/ui/__init__.py 2010-03-25 07:34:15 +0000
@@ -105,10 +105,22 @@
This tells the library how to display things to the user. Through this
layer different applications can choose the style of UI.
+
+ :ivar suppressed_warnings: Identifiers for user warnings that should
+ no be emitted.
"""
+ _user_warning_templates = dict(
+ cross_format_fetch=("Doing on-the-fly conversion from "
+ "%(from_format)s to %(to_format)s.\n"
+ "This may take some time. Upgrade the repositories to the "
+ "same format for better performance."
+ )
+ )
+
def __init__(self):
self._task_stack = []
+ self.suppressed_warnings = set()
self._quiet = False
def be_quiet(self, state):
@@ -210,6 +222,21 @@
"""
pass
+ def format_user_warning(self, warning_id, message_args):
+ try:
+ template = self._user_warning_templates[warning_id]
+ except KeyError:
+ fail = "failed to format warning %r, %r" % (warning_id, message_args)
+ warnings.warn(fail) # so tests will fail etc
+ return fail
+ try:
+ return template % message_args
+ except ValueError, e:
+ fail = "failed to format warning %r, %r: %s" % (
+ warning_id, message_args, e)
+ warnings.warn(fail) # so tests will fail etc
+ return fail
+
def get_boolean(self, prompt):
"""Get a boolean question answered from the user.
@@ -240,8 +267,11 @@
def recommend_upgrade(self,
current_format_name,
basedir):
- # this should perhaps be in the TextUIFactory and the default can do
+ # XXX: this should perhaps be in the TextUIFactory and the default can do
# nothing
+ #
+ # XXX: Change to show_user_warning - that will accomplish the previous
+ # xxx. -- mbp 2010-02-25
trace.warning("%s is deprecated "
"and a better format is available.\n"
"It is recommended that you upgrade by "
@@ -271,6 +301,24 @@
# Default implementation just does nothing
pass
+ def show_user_warning(self, warning_id, **message_args):
+ """Show a warning to the user.
+
+ This is specifically for things that are under the user's control (eg
+ outdated formats), not for internal program warnings like deprecated
+ APIs.
+
+ This can be overridden by UIFactory subclasses to show it in some
+ appropriate way; the default UIFactory is noninteractive and does
+ nothing. format_user_warning maps it to a string, though other
+ presentations can be used for particular UIs.
+
+ :param warning_id: An identifier like 'cross_format_fetch' used to
+ check if the message is suppressed and to look up the string.
+ :param message_args: Arguments to be interpolated into the message.
+ """
+ pass
+
def show_error(self, msg):
"""Show an error message (not an exception) to the user.
@@ -288,12 +336,13 @@
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))
+ """Warn about a potentially slow cross-format transfer.
+
+ This is deprecated in favor of show_user_warning, but retained for api
+ compatibility in 2.0 and 2.1.
+ """
+ self.show_user_warning('cross_format_fetch', from_format=from_format,
+ to_format=to_format)
def warn_experimental_format_fetch(self, inter):
"""Warn about fetching into experimental repository formats."""
=== modified file 'bzrlib/ui/text.py'
--- a/bzrlib/ui/text.py 2010-02-23 07:43:11 +0000
+++ b/bzrlib/ui/text.py 2010-03-25 07:34:15 +0000
@@ -253,6 +253,18 @@
def _progress_all_finished(self):
self._progress_view.clear()
+ def show_user_warning(self, warning_id, **message_args):
+ """Show a text message to the user.
+
+ Explicitly not for warnings about bzr apis, deprecations or internals.
+ """
+ # eventually trace.warning should migrate here, to avoid logging and
+ # be easier to test; that has a lot of test fallout so for now just
+ # new code can call this
+ if warning_id not in self.suppressed_warnings:
+ self.stderr.write(self.format_user_warning(warning_id, message_args) +
+ '\n')
+
class TextProgressView(object):
"""Display of progress bar and other information on a tty.
=== modified file 'bzrlib/upgrade.py'
--- a/bzrlib/upgrade.py 2010-02-17 13:49:11 +0000
+++ b/bzrlib/upgrade.py 2010-03-25 07:34:15 +0000
@@ -28,13 +28,21 @@
def __init__(self, url, format=None):
self.format = format
self.bzrdir = BzrDir.open_unsupported(url)
+ # XXX: Change to cleanup
+ warning_id = 'cross_format_fetch'
+ saved_warning = warning_id in ui.ui_factory.suppressed_warnings
if isinstance(self.bzrdir, RemoteBzrDir):
self.bzrdir._ensure_real()
self.bzrdir = self.bzrdir._real_bzrdir
if self.bzrdir.root_transport.is_readonly():
raise errors.UpgradeReadonly
self.transport = self.bzrdir.root_transport
- self.convert()
+ ui.ui_factory.suppressed_warnings.add(warning_id)
+ try:
+ self.convert()
+ finally:
+ if not saved_warning:
+ ui.ui_factory.suppressed_warnings.remove(warning_id)
def convert(self):
try:
=== modified file 'doc/en/user-guide/stacked.txt'
--- a/doc/en/user-guide/stacked.txt 2010-03-18 08:03:39 +0000
+++ b/doc/en/user-guide/stacked.txt 2010-03-25 07:34:15 +0000
@@ -82,25 +82,38 @@
This usage fits the scenario described in the Motivation section.
-If the local branch was created as a stacked branch, then you can
-use the ``--stacked`` option to ``push`` and the *stacked-on* location
-will be implicit. For example::
-
- bzr branch --stacked source-url my-dir
- cd my-dir
- (hack, hack, hack)
- bzr commit -m "fix bug"
- bzr push --stacked
+
+.. The following text is hidden because bug 375013 breaks the example.
+ When bug 375013 is fixed, we should unhide this text.
+ - Andrew Bennetts, 10 March 2010
+
+.. If the local branch was created as a stacked branch, then you can
+.. use the ``--stacked`` option to ``push`` and the *stacked-on* location
+.. will be implicit. For example::
+..
+.. bzr branch --stacked source-url my-dir
+.. cd my-dir
+.. (hack, hack, hack)
+.. bzr commit -m "fix bug"
+.. bzr push --stacked
Limitations of stacked branches
-------------------------------
+Currently, you cannot commit to a stacked branch, due to `bug 375013`_.
+
+.. _bug 375013: https://bugs.launchpad.net/bzr/+bug/375013
+
The important thing to remember about a stacked branch is that the
stacked-on branch needs to be available for almost all operations. This is
not an issue when both branches are local or both branches are on the
same server.
+Similarly, because most of the history is stored in the stacked-on repository,
+operations like ``bzr log`` can be slower when the stacked-on repository is
+accessed via a network.
+
Changing branch stacking
------------------------
More information about the bazaar-commits
mailing list