[RFC] Conditionalize format warnings
Matthew D. Fuller
fullermd at over-yonder.net
Fri Apr 6 12:21:12 BST 2007
I've taken a stab at adding a config param to allow shutting off
outdated-format warnings, so you can tell bzr "I know, and I don't
care, so shaddup". Attached.
I'm not entirely happy with it. The big problem is that it can only
read it out of the global config. It can't use it from the per-branch
config (and why don't we have per-WT and per-repo configs? Something
like this belongs in them just as much as in the branch, particularly
as the format we're warning about is a WT) because I can't find any
way to give it a context to look that up in. That could just be a
side effect of not knowing bzrlib, not knowing python, and not getting
along with OOP, but I've reached my limit on pursuing it.
--
Matthew Fuller (MF4839) | fullermd at over-yonder.net
Systems/Network Administrator | http://www.over-yonder.net/~fullermd/
On the Internet, nobody can hear you scream.
-------------- next part --------------
# Bazaar revision bundle v0.9
#
# message:
# Add a config param to allow disabling warnings for outdated formats.
#
# committer: Matthew Fuller <fullermd at over-yonder.net>
# date: Fri 2007-04-06 06:10:10.085999966 -0500
=== modified file bzrlib/bzrdir.py
--- bzrlib/bzrdir.py
+++ bzrlib/bzrdir.py
@@ -40,6 +40,7 @@
import bzrlib
from bzrlib import (
+ config,
errors,
lockable_files,
lockdir,
@@ -137,7 +138,9 @@
if not allow_unsupported and not format.is_supported():
# see open_downlevel to open legacy branches.
raise errors.UnsupportedFormatError(format=format)
+ fwarn = config.GlobalConfig().get_format_warning()
if recommend_upgrade \
+ and fwarn == "yes" \
and getattr(format, 'upgrade_recommended', False):
ui.ui_factory.recommend_upgrade(
format.get_format_description(),
=== modified file bzrlib/config.py
--- bzrlib/config.py
+++ bzrlib/config.py
@@ -29,6 +29,7 @@
create_signatures=always|never|when-required(default)
gpg_signing_command=name-of-program
log_format=name-of-format
+format_warning=no|yes(default)
in locations.conf, you specify the url of a branch and options for it.
Wildcards may be used - * and ? as normal in shell completion. Options
@@ -52,6 +53,8 @@
branch is configured to require them.
log_format - this option sets the default log format. Possible values are
long, short, line, or a plugin can register new formats.
+format_warning - this option allows you to disable warnings for outdated
+ formats.
In bazaar.conf you can also define aliases in the ALIASES sections, example
@@ -272,6 +275,19 @@
def _get_nickname(self):
return None
+ def get_format_warning(self):
+ """Warn for outdated formats?"""
+ dowarn = self._get_format_warning()
+ if dowarn is None or dowarn.lower() == "yes":
+ return "yes"
+ if dowarn.lower() == "no":
+ return "no"
+ raise AssertionError("Unknown format_warning value '%s' in %s"
+ % (dowarn, self._get_filename()))
+
+ def _get_format_warning(self):
+ return None
+
class IniBasedConfig(Config):
"""A configuration policy that draws from ini files."""
@@ -399,6 +415,9 @@
def _get_nickname(self):
return self.get_user_option('nickname')
+ def _get_format_warning(self):
+ return self.get_user_option('format_warning')
+
class GlobalConfig(IniBasedConfig):
"""The configuration that should be used for a specific location."""
=== modified directory // last-changed:fullermd at over-yonder.net-20070406111010
... -kbchkq0zgfz26jd4
# revision id: fullermd at over-yonder.net-20070406111010-kbchkq0zgfz26jd4
# sha1: 5d7ff824662b3a33be3e08df4753e5b74e488114
# inventory sha1: 22ff7aa4dadb6b000590ede369b3a6b2e19120ec
# parent ids:
# pqm at pqm.ubuntu.com-20070405073143-8fa894c829ab5e50
# base id: pqm at pqm.ubuntu.com-20070405073143-8fa894c829ab5e50
# properties:
# branch-nick: conditionalize-format-warning
More information about the bazaar
mailing list