[patch] warn on deprecated formats
Martin Pool
mbp at canonical.com
Fri Aug 11 10:10:25 BST 2006
Robert suggested we should put something like this in for 0.9 to remind
people to upgrade. I agree.
--
Martin
-------------- next part --------------
=== modified file 'bzrlib/repository.py'
--- bzrlib/repository.py 2006-07-29 14:37:24 +0000
+++ bzrlib/repository.py 2006-08-11 08:14:01 +0000
@@ -40,7 +40,7 @@
zero_nine,
)
from bzrlib.testament import Testament
-from bzrlib.trace import mutter, note
+from bzrlib.trace import mutter, note, warning
from bzrlib.tsort import topo_sort
from bzrlib.weave import WeaveFile
@@ -188,6 +188,7 @@
self.control_weaves = control_store
# TODO: make sure to construct the right store classes, etc, depending
# on whether escaping is required.
+ self._warn_if_deprecated()
def __repr__(self):
return '%s(%r)' % (self.__class__.__name__,
@@ -680,6 +681,14 @@
result.check()
return result
+ def _warn_if_deprecated(self):
+ global _deprecation_warning_given
+ ## if _deprecation_warning_given:
+ ## return
+ _deprecation_warning_given = True
+ warning("Format %s for %s is deprecated - please use 'bzr upgrade' to get better performance"
+ % (self._format, self.bzrdir.transport.base))
+
class AllInOneRepository(Repository):
"""Legacy support - the repository behaviour for all-in-one branches."""
@@ -792,7 +801,6 @@
_revision_store,
control_store,
text_store)
-
dir_mode = self.control_files._dir_mode
file_mode = self.control_files._file_mode
@@ -827,6 +835,10 @@
class KnitRepository(MetaDirRepository):
"""Knit format repository."""
+ def _warn_if_deprecated(self):
+ # This class isn't deprecated
+ pass
+
def _inventory_add_lines(self, inv_vf, revid, parents, lines):
inv_vf.add_lines_with_ghosts(revid, parents, lines)
@@ -999,6 +1011,9 @@
_formats = {}
"""The known formats."""
+ def __str__(self):
+ return "<%s>" % self.__class__.__name__
+
@classmethod
def find_format(klass, a_bzrdir):
"""Return the format for the repository object in a_bzrdir."""
More information about the bazaar
mailing list