Rev 2255: Add deprecated forwarders for old formats from repository.py in file:///home/mbp/bzr/Work/repoformats/

Martin Pool mbp at sourcefrog.net
Mon Feb 12 06:12:15 GMT 2007


------------------------------------------------------------
revno: 2255
revision-id: mbp at sourcefrog.net-20070212061214-ff5rahaaqxz4jbtu
parent: mbp at sourcefrog.net-20070212050955-ctczxopwvmco8rv0
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: repoformats
timestamp: Mon 2007-02-12 17:12:14 +1100
message:
  Add deprecated forwarders for old formats from repository.py
modified:
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2007-02-12 05:09:55 +0000
+++ b/bzrlib/repository.py	2007-02-12 06:12:14 +0000
@@ -766,6 +766,42 @@
                     raise errors.NonAsciiRevisionId(method, self)
 
 
+
+# remove these delegates a while after bzr 0.15
+def __make_delegated(name, from_module):
+    def _deprecated_repository_forwarder():
+        symbol_versioning.warn('%s moved to %s in bzr 0.15'
+            % (name, from_module),
+            DeprecationWarning)
+        m = __import__(from_module, globals(), locals(), [name])
+        try:
+            return getattr(m, name)
+        except AttributeError:
+            raise AttributeError('module %s has no name %s'
+                    % (m, name))
+    globals()[name] = _deprecated_repository_forwarder
+
+for _name in [
+        'AllInOneRepository',
+        'WeaveMetaDirRepository',
+        'PreSplitOutRepositoryFormat',
+        'RepositoryFormat4',
+        'RepositoryFormat5',
+        'RepositoryFormat6',
+        'RepositoryFormat7',
+        ]:
+    __make_delegated(_name, 'bzrlib.repofmt.weaverepo')
+
+for _name in [
+        'KnitRepository',
+        'KnitRepository2',
+        'RepositoryFormatKnit',
+        'RepositoryFormatKnit1',
+        'RepositoryFormatKnit2',
+        ]:
+    __make_delegated(_name, 'bzrlib.repofmt.knitrepo')
+
+
 def install_revision(repository, rev, revision_tree):
     """Install all revision data into a repository."""
     present_parents = []




More information about the bazaar-commits mailing list