Rev 4235: Merge Matt Nordhoff's fix for RemoteBranchConfig. in http://people.ubuntu.com/~robertc/baz2.0/pending/RemoteBranchConfig

Robert Collins robertc at robertcollins.net
Fri Apr 3 02:21:16 BST 2009


At http://people.ubuntu.com/~robertc/baz2.0/pending/RemoteBranchConfig

------------------------------------------------------------
revno: 4235
revision-id: robertc at robertcollins.net-20090403012106-4ivume8jwo0uvxe1
parent: robertc at robertcollins.net-20090403010508-dyujd8cj4sab3uh7
parent: mnordhoff at mattnordhoff.com-20090402222415-f0ffovf74qqe9qji
committer: Robert Collins <robertc at robertcollins.net>
branch nick: RemoteBranchConfig
timestamp: Fri 2009-04-03 12:21:06 +1100
message:
  Merge Matt Nordhoff's fix for RemoteBranchConfig.
modified:
  bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
  bzrlib/tests/test_remote.py    test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
    ------------------------------------------------------------
    revno: 4226.1.17
    revision-id: mnordhoff at mattnordhoff.com-20090402222415-f0ffovf74qqe9qji
    parent: mnordhoff at mattnordhoff.com-20090402214125-u68a3kwuafc66j04
    committer: Matt Nordhoff <mnordhoff at mattnordhoff.com>
    branch nick: fix_get_config_file
    timestamp: Thu 2009-04-02 22:24:15 +0000
    message:
      Add a test
    modified:
      bzrlib/tests/test_remote.py    test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
    ------------------------------------------------------------
    revno: 4226.1.16
    revision-id: mnordhoff at mattnordhoff.com-20090402214125-u68a3kwuafc66j04
    parent: pqm at pqm.ubuntu.com-20090402163502-ryn8zr2giilw5bki
    committer: Matt Nordhoff <mnordhoff at mattnordhoff.com>
    branch nick: fix_get_config_file
    timestamp: Thu 2009-04-02 21:41:25 +0000
    message:
      Fix Branch.get_config_file smart verb on multi-line config files. (Bug #354075)
    modified:
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py	2009-04-03 00:37:53 +0000
+++ b/bzrlib/remote.py	2009-04-03 01:21:06 +0000
@@ -2393,8 +2393,8 @@
             'Branch.get_config_file', path)
         if response[0][0] != 'ok':
             raise UnexpectedSmartServerResponse(response)
-        bytes = response[1].read_body_bytes()
-        return config.ConfigObj([bytes], encoding='utf-8')
+        lines = response[1].read_body_bytes().splitlines()
+        return config.ConfigObj(lines, encoding='utf-8')
 
     def set_option(self, value, name, section=None):
         """Set the value associated with a named option.

=== modified file 'bzrlib/tests/test_remote.py'
--- a/bzrlib/tests/test_remote.py	2009-04-02 05:22:42 +0000
+++ b/bzrlib/tests/test_remote.py	2009-04-03 01:21:06 +0000
@@ -1350,6 +1350,20 @@
              ('call_expecting_body', 'Branch.get_config_file', ('memory:///',))],
             client._calls)
 
+    def test_get_multi_line_branch_conf(self):
+        # Make sure that multiple-line branch.conf files are supported
+        #
+        # https://bugs.edge.launchpad.net/bzr/+bug/354075
+        client = FakeClient()
+        client.add_expected_call(
+            'Branch.get_stacked_on_url', ('memory:///',),
+            'error', ('NotStacked',),)
+        client.add_success_response_with_body('a = 1\nb = 2\nc = 3\n', 'ok')
+        transport = MemoryTransport()
+        branch = self.make_remote_branch(transport, client)
+        config = branch.get_config()
+        self.assertEqual(u'2', config.get_user_option('b'))
+
     def test_set_option(self):
         client = FakeClient()
         client.add_expected_call(




More information about the bazaar-commits mailing list