Rev 4793: (andrew) Show real branch/repo format description in 'info -v' over in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Nov 11 23:49:46 GMT 2009


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

------------------------------------------------------------
revno: 4793 [merge]
revision-id: pqm at pqm.ubuntu.com-20091111234944-3qg63sv4d66bs2z8
parent: pqm at pqm.ubuntu.com-20091108030011-4ifz210jwrd3ewkv
parent: andrew.bennetts at canonical.com-20091111224653-1nbg3zepghdqlcqm
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2009-11-11 23:49:44 +0000
message:
  (andrew) Show real branch/repo format description in 'info -v' over
  	HPSS. (#196080)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
  bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
  bzrlib/tests/per_repository/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
  bzrlib/tests/test_remote.py    test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
=== modified file 'NEWS'
--- a/NEWS	2009-11-08 03:00:11 +0000
+++ b/NEWS	2009-11-11 06:50:40 +0000
@@ -36,6 +36,9 @@
   allow those because XML store silently translate it anyway. (The parser
   auto-translates \r\n => \n in ways that are hard for us to catch.)
 
+* Show correct branch and repository format descriptions in 
+  ``bzr info -v`` on a smart server location.  (Andrew Bennetts, #196080)
+
 * The fix for bug #186920 accidentally broke compatibility with python
   2.4.  (Vincent Ladeuil, #475585)
 

=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2009-09-24 09:45:23 +0000
+++ b/bzrlib/bzrdir.py	2009-11-11 06:50:40 +0000
@@ -3111,6 +3111,9 @@
         self._network_name = None
 
     def get_format_description(self):
+        if self._network_name:
+            real_format = network_format_registry.get(self._network_name)
+            return 'Remote:' + real_format.get_format_description()
         return 'bzr remote bzrdir'
 
     def get_format_string(self):

=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py	2009-11-07 22:10:37 +0000
+++ b/bzrlib/remote.py	2009-11-11 06:50:40 +0000
@@ -601,7 +601,8 @@
         return self._custom_format._fetch_reconcile
 
     def get_format_description(self):
-        return 'bzr remote repository'
+        self._ensure_real()
+        return 'Remote: ' + self._custom_format.get_format_description()
 
     def __eq__(self, other):
         return self.__class__ is other.__class__
@@ -1999,7 +2000,8 @@
                 self._network_name)
 
     def get_format_description(self):
-        return 'Remote BZR Branch'
+        self._ensure_real()
+        return 'Remote: ' + self._custom_format.get_format_description()
 
     def network_name(self):
         return self._network_name

=== modified file 'bzrlib/tests/per_repository/test_repository.py'
--- a/bzrlib/tests/per_repository/test_repository.py	2009-10-29 05:54:49 +0000
+++ b/bzrlib/tests/per_repository/test_repository.py	2009-11-11 22:46:53 +0000
@@ -604,11 +604,11 @@
 
     def test_upgrade_from_format4(self):
         from bzrlib.tests.test_upgrade import _upgrade_dir_template
+        if isinstance(self.repository_format, remote.RemoteRepositoryFormat):
+            return # local conversion to/from RemoteObjects is irrelevant.
         if self.repository_format.get_format_description() \
             == "Repository format 4":
             raise TestSkipped('Cannot convert format-4 to itself')
-        if isinstance(self.repository_format, remote.RemoteRepositoryFormat):
-            return # local conversion to/from RemoteObjects is irrelevant.
         self.build_tree_contents(_upgrade_dir_template)
         old_repodir = bzrlib.bzrdir.BzrDir.open_unsupported('.')
         old_repo_format = old_repodir.open_repository()._format

=== modified file 'bzrlib/tests/test_remote.py'
--- a/bzrlib/tests/test_remote.py	2009-10-15 04:01:26 +0000
+++ b/bzrlib/tests/test_remote.py	2009-11-11 06:50:40 +0000
@@ -27,6 +27,7 @@
 from cStringIO import StringIO
 
 from bzrlib import (
+    branch,
     bzrdir,
     config,
     errors,
@@ -36,7 +37,6 @@
     pack,
     remote,
     repository,
-    smart,
     tests,
     treebuilder,
     urlutils,
@@ -61,9 +61,8 @@
     condition_isinstance,
     split_suite_by_condition,
     multiply_tests,
-    KnownFailure,
     )
-from bzrlib.transport import get_transport, http
+from bzrlib.transport import get_transport
 from bzrlib.transport.memory import MemoryTransport
 from bzrlib.transport.remote import (
     RemoteTransport,
@@ -1782,6 +1781,20 @@
         return repo, client
 
 
+def remoted_description(format):
+    return 'Remote: ' + format.get_format_description()
+
+
+class TestBranchFormat(tests.TestCase):
+
+    def test_get_format_description(self):
+        remote_format = RemoteBranchFormat()
+        real_format = branch.BranchFormat.get_default_format()
+        remote_format._network_name = real_format.network_name()
+        self.assertEqual(remoted_description(real_format),
+            remote_format.get_format_description())
+
+
 class TestRepositoryFormat(TestRemoteRepository):
 
     def test_fast_delta(self):
@@ -1794,6 +1807,13 @@
         false_format._network_name = false_name
         self.assertEqual(False, false_format.fast_deltas)
 
+    def test_get_format_description(self):
+        remote_repo_format = RemoteRepositoryFormat()
+        real_format = repository.RepositoryFormat.get_default_format()
+        remote_repo_format._network_name = real_format.network_name()
+        self.assertEqual(remoted_description(real_format),
+            remote_repo_format.get_format_description())
+
 
 class TestRepositoryGatherStats(TestRemoteRepository):
 




More information about the bazaar-commits mailing list