Rev 5022: (Jelmer) Warn about fetching into experimental formats. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Feb 10 18:29:57 GMT 2010


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5022 [merge]
revision-id: pqm at pqm.ubuntu.com-20100210182950-7fdfub9g9a2lplf3
parent: pqm at pqm.ubuntu.com-20100210162528-00g29u0ex6vzv914
parent: jelmer at samba.org-20100129121315-i2hbteyvnyypm11s
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2010-02-10 18:29:50 +0000
message:
  (Jelmer) Warn about fetching into experimental formats.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/repofmt/knitrepo.py     knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
  bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tests/blackbox/test_pull.py test_pull.py-20051201144907-64959364f629947f
  bzrlib/tests/per_repository/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
  bzrlib/ui/__init__.py          ui.py-20050824083933-8cf663c763ba53a9
=== modified file 'NEWS'
--- a/NEWS	2010-02-10 15:46:03 +0000
+++ b/NEWS	2010-02-10 18:29:50 +0000
@@ -84,6 +84,9 @@
 Improvements
 ************
 
+* Fetching into experimental formats will now print a warning. (Jelmer
+  Vernooij)
+
 Documentation
 *************
 

=== modified file 'bzrlib/repofmt/knitrepo.py'
--- a/bzrlib/repofmt/knitrepo.py	2009-08-14 11:11:29 +0000
+++ b/bzrlib/repofmt/knitrepo.py	2010-01-29 10:59:12 +0000
@@ -444,6 +444,7 @@
     repository_class = KnitRepository
     _commit_builder_class = RootCommitBuilder
     rich_root_data = True
+    experimental = True
     supports_tree_reference = True
     @property
     def _serializer(self):

=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py	2010-01-21 21:13:09 +0000
+++ b/bzrlib/repofmt/pack_repo.py	2010-01-29 10:59:12 +0000
@@ -2615,6 +2615,7 @@
     repository_class = KnitPackRepository
     _commit_builder_class = PackRootCommitBuilder
     rich_root_data = True
+    experimental = True
     supports_tree_reference = True
     @property
     def _serializer(self):
@@ -2888,6 +2889,7 @@
     repository_class = KnitPackRepository
     _commit_builder_class = PackRootCommitBuilder
     rich_root_data = True
+    experimental = True
     supports_tree_reference = True
     supports_external_lookups = True
     # What index classes to use

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2010-02-09 19:04:02 +0000
+++ b/bzrlib/repository.py	2010-02-10 18:29:50 +0000
@@ -3075,6 +3075,8 @@
     pack_compresses = False
     # Does the repository inventory storage understand references to trees?
     supports_tree_reference = None
+    # Is the format experimental ?
+    experimental = False
 
     def __str__(self):
         return "<%s>" % self.__class__.__name__
@@ -3414,6 +3416,7 @@
         :param pb: ignored.
         :return: None.
         """
+        ui.ui_factory.warn_experimental_format_fetch(self)
         f = _mod_fetch.RepoFetcher(to_repository=self.target,
                                from_repository=self.source,
                                last_revision=revision_id,
@@ -4004,6 +4007,7 @@
         # 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()):
             self._converting_to_rich_root = True

=== modified file 'bzrlib/tests/blackbox/test_pull.py'
--- a/bzrlib/tests/blackbox/test_pull.py	2010-01-25 15:55:48 +0000
+++ b/bzrlib/tests/blackbox/test_pull.py	2010-01-29 11:17:16 +0000
@@ -433,3 +433,23 @@
             from_tree.branch.bzrdir.root_transport.base])
         self.assertContainsRe(err,
             "(?m)Doing on-the-fly conversion")
+
+    def test_pull_to_experimental_format_warning(self):
+        """You get a warning for pulling into experimental formats.
+        """
+        from_tree = self.make_branch_and_tree('from', format='development-subtree')
+        to_tree = self.make_branch_and_tree('to', format='development-subtree')
+        from_tree.commit(message='first commit')
+        out, err = self.run_bzr(['pull', '-d', 'to', 'from'])
+        self.assertContainsRe(err,
+            "(?m)Fetching into experimental format")
+
+    def test_pull_cross_to_experimental_format_warning(self):
+        """You get a warning for pulling into experimental formats.
+        """
+        from_tree = self.make_branch_and_tree('from', format='2a')
+        to_tree = self.make_branch_and_tree('to', format='development-subtree')
+        from_tree.commit(message='first commit')
+        out, err = self.run_bzr(['pull', '-d', 'to', 'from'])
+        self.assertContainsRe(err,
+            "(?m)Fetching into experimental format")

=== modified file 'bzrlib/tests/per_repository/test_repository.py'
--- a/bzrlib/tests/per_repository/test_repository.py	2010-02-05 14:36:54 +0000
+++ b/bzrlib/tests/per_repository/test_repository.py	2010-02-10 18:29:50 +0000
@@ -83,6 +83,9 @@
         """Test the _fetch_reconcile attribute."""
         self.assertFormatAttribute('_fetch_reconcile', (True, False))
 
+    def test_attribute_format_experimental(self):
+        self.assertFormatAttribute('experimental', (True, False))
+
     def test_attribute_format_pack_compresses(self):
         self.assertFormatAttribute('pack_compresses', (True, False))
 

=== modified file 'bzrlib/ui/__init__.py'
--- a/bzrlib/ui/__init__.py	2010-02-09 19:04:02 +0000
+++ b/bzrlib/ui/__init__.py	2010-02-10 18:29:50 +0000
@@ -295,6 +295,14 @@
             "same format for better performance.\n" %
             (from_format, to_format))
 
+    def warn_experimental_format_fetch(self, inter):
+        """Warn about fetching into experimental repository formats."""
+        if inter.target._format.experimental:
+            trace.warning("Fetching into experimental format %s.\n"
+                "This format may be unreliable or change in the future "
+                "without an upgrade path.\n" % (inter.target._format,))
+
+
 
 class SilentUIFactory(UIFactory):
     """A UI Factory which never prints anything.




More information about the bazaar-commits mailing list