Rev 3411: (mbp) Remove erroneous handling of branch.conf for RemoteBranch in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed May 7 09:48:46 BST 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3411
revision-id:pqm at pqm.ubuntu.com-20080507084835-066pb8ddwett0ne3
parent: pqm at pqm.ubuntu.com-20080507072716-lr54bdt55km4feso
parent: mbp at sourcefrog.net-20080507060309-3z69hj7on7cud6wb
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2008-05-07 09:48:35 +0100
message:
(mbp) Remove erroneous handling of branch.conf for RemoteBranch
modified:
bzrlib/config.py config.py-20051011043216-070c74f4e9e338e8
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/smart/branch.py branch.py-20061124031907-mzh3pla28r83r97f-1
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
------------------------------------------------------------
revno: 3408.3.1
revision-id:mbp at sourcefrog.net-20080507060309-3z69hj7on7cud6wb
parent: pqm at pqm.ubuntu.com-20080506114010-jwclr2qtiekvawjg
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: branch_conf
timestamp: Wed 2008-05-07 16:03:09 +1000
message:
Remove erroneous handling of branch.conf for RemoteBranch
modified:
bzrlib/config.py config.py-20051011043216-070c74f4e9e338e8
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/smart/branch.py branch.py-20061124031907-mzh3pla28r83r97f-1
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py 2008-05-01 04:09:39 +0000
+++ b/bzrlib/config.py 2008-05-07 06:03:09 +0000
@@ -890,6 +890,8 @@
class TreeConfig(IniBasedConfig):
"""Branch configuration data associated with its contents, not location"""
+ # XXX: Really needs a better name, as this is not part of the tree! -- mbp 20080507
+
def __init__(self, branch):
transport = branch.control_files._transport
self._config = TransportConfig(transport, 'branch.conf')
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py 2008-05-07 05:09:19 +0000
+++ b/bzrlib/remote.py 2008-05-07 08:48:35 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006, 2007 Canonical Ltd
+# Copyright (C) 2006, 2007, 2008 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -1157,24 +1157,6 @@
self._dir_mode = None
self._file_mode = None
- def get(self, path):
- """'get' a remote path as per the LockableFiles interface.
-
- :param path: the file to 'get'. If this is 'branch.conf', we do not
- just retrieve a file, instead we ask the smart server to generate
- a configuration for us - which is retrieved as an INI file.
- """
- if path == 'branch.conf':
- path = self.bzrdir._path_for_remote_call(self._client)
- response = self._client.call_expecting_body(
- 'Branch.get_config_file', path)
- assert response[0][0] == 'ok', \
- 'unexpected response code %s' % (response[0],)
- return StringIO(response[1].read_body_bytes())
- else:
- # VFS fallback.
- return LockableFiles.get(self, path)
-
class RemoteBranchFormat(branch.BranchFormat):
@@ -1469,9 +1451,6 @@
self._ensure_real()
return self._real_branch.set_parent(url)
- def get_config(self):
- return RemoteBranchConfig(self)
-
def sprout(self, to_bzrdir, revision_id=None):
# Like Branch.sprout, except that it sprouts a branch in the default
# format, because RemoteBranches can't be created at arbitrary URLs.
@@ -1546,19 +1525,6 @@
other, stop_revision=stop_revision, overwrite=overwrite)
-class RemoteBranchConfig(BranchConfig):
-
- def username(self):
- self.branch._ensure_real()
- return self.branch._real_branch.get_config().username()
-
- def _get_branch_data_config(self):
- self.branch._ensure_real()
- if self._branch_data_config is None:
- self._branch_data_config = TreeConfig(self.branch._real_branch)
- return self._branch_data_config
-
-
def _extract_tar(tar, to_dir):
"""Extract all the contents of a tarfile object.
=== modified file 'bzrlib/smart/branch.py'
--- a/bzrlib/smart/branch.py 2008-04-08 08:13:33 +0000
+++ b/bzrlib/smart/branch.py 2008-05-07 06:03:09 +0000
@@ -80,6 +80,11 @@
The body is not utf8 decoded - its the literal bytestream from disk.
"""
+ # This was at one time called by RemoteBranchLockableFiles
+ # intercepting access to this file; as of 1.5 it is not called by the
+ # client but retained for compatibility. It may be called again to
+ # allow the client to get the configuration without needing vfs
+ # access.
try:
content = branch.control_files.get('branch.conf').read()
except errors.NoSuchFile:
=== modified file 'bzrlib/tests/test_remote.py'
--- a/bzrlib/tests/test_remote.py 2008-05-02 05:10:09 +0000
+++ b/bzrlib/tests/test_remote.py 2008-05-07 06:03:09 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006, 2007 Canonical Ltd
+# Copyright (C) 2006, 2007, 2008 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -603,17 +603,18 @@
class TestBranchControlGetBranchConf(tests.TestCaseWithMemoryTransport):
- """Test branch.control_files api munging...
-
- We special case RemoteBranch.control_files.get('branch.conf') to
- call a specific API so that RemoteBranch's can intercept configuration
- file reading, allowing them to signal to the client about things like
- 'email is configured for commits'.
+ """Getting the branch configuration should use an abstract method not vfs.
"""
def test_get_branch_conf(self):
+ raise tests.KnownFailure('branch.conf is not retrieved by get_config_file')
+ # We should see that branch.get_config() does a single rpc to get the
+ # remote configuration file, abstracting away where that is stored on
+ # the server. However at the moment it always falls back to using the
+ # vfs, and this would need some changes in config.py.
+
# in an empty branch we decode the response properly
- client = FakeClient([(('ok', ), 'config file body')], self.get_url())
+ client = FakeClient([(('ok', ), '# config file body')], self.get_url())
# we need to make a real branch because the remote_branch.control_files
# will trigger _ensure_real.
branch = self.make_branch('quack')
@@ -621,11 +622,10 @@
# we do not want bzrdir to make any remote calls
bzrdir = RemoteBzrDir(transport, _client=False)
branch = RemoteBranch(bzrdir, None, _client=client)
- result = branch.control_files.get('branch.conf')
+ config = branch.get_config()
self.assertEqual(
[('call_expecting_body', 'Branch.get_config_file', ('quack/',))],
client._calls)
- self.assertEqual('config file body', result.read())
class TestBranchLockWrite(tests.TestCase):
More information about the bazaar-commits
mailing list