Rev 2892: Introduce bzr_remote_path configuration variable in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Sat Oct 6 15:45:49 BST 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 2892
revision-id: pqm at pqm.ubuntu.com-20071006144547-0e1mpht72yd6wyfz
parent: pqm at pqm.ubuntu.com-20071006081035-7jsqv4bddh63ohdc
parent: abentley at panoramicfeedback.com-20071005145504-mod67bj9io6yi16k
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sat 2007-10-06 15:45:47 +0100
message:
Introduce bzr_remote_path configuration variable
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/config.py config.py-20051011043216-070c74f4e9e338e8
bzrlib/smart/medium.py medium.py-20061103051856-rgu2huy59fkz902q-1
bzrlib/tests/test_config.py testconfig.py-20051011041908-742d0c15d8d8c8eb
bzrlib/tests/test_smart_transport.py test_ssh_transport.py-20060608202016-c25gvf1ob7ypbus6-2
bzrlib/transport/remote.py ssh.py-20060608202016-c25gvf1ob7ypbus6-1
doc/en/user-guide/configuration.txt configuration.txt-20060314161707-868350809502af01
------------------------------------------------------------
revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.18
merged: abentley at panoramicfeedback.com-20071005145504-mod67bj9io6yi16k
parent: abentley at panoramicfeedback.com-20071005145202-tozxvsta529kllhm
committer: Aaron Bentley <abentley at panoramicfeedback.com>
branch nick: Aaron's mergeable stuff
timestamp: Fri 2007-10-05 10:55:04 -0400
message:
Add NEWS
------------------------------------------------------------
revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.17
merged: abentley at panoramicfeedback.com-20071005145202-tozxvsta529kllhm
parent: abentley at panoramicfeedback.com-20071005125853-46tdy9ivm1jrxcp7
committer: Aaron Bentley <abentley at panoramicfeedback.com>
branch nick: Aaron's mergeable stuff
timestamp: Fri 2007-10-05 10:52:02 -0400
message:
Introduce bzr_remote_path configuration variable
------------------------------------------------------------
revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.16
merged: abentley at panoramicfeedback.com-20071005125853-46tdy9ivm1jrxcp7
parent: abentley at panoramicfeedback.com-20070831170110-xxxu8urr6ephd9po
parent: pqm at pqm.ubuntu.com-20071005032619-b6c99y625rawducb
committer: Aaron Bentley <abentley at panoramicfeedback.com>
branch nick: Aaron's mergeable stuff
timestamp: Fri 2007-10-05 08:58:53 -0400
message:
Merge mainline
------------------------------------------------------------
revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.15
merged: abentley at panoramicfeedback.com-20070831170110-xxxu8urr6ephd9po
parent: aaron.bentley at utoronto.ca-20070828055853-13q2eewfz10fq8r2
parent: pqm at pqm.ubuntu.com-20070831085255-w43drl9sistvl5dl
committer: Aaron Bentley <abentley at panoramicfeedback.com>
branch nick: Aaron's mergeable stuff
timestamp: Fri 2007-08-31 13:01:10 -0400
message:
Merge from bzr.dev
=== modified file 'NEWS'
--- a/NEWS 2007-10-04 17:10:53 +0000
+++ b/NEWS 2007-10-05 14:55:04 +0000
@@ -35,6 +35,10 @@
* New ``revert --forget-merges`` command, which removes the record of a pending
merge without affecting the working tree contents. (Martin Pool)
+ * New ``bzr_remote_path`` configuration variable allows finer control of
+ remote bzr locations than BZR_REMOTE_PATH environment variable.
+ (Aaron Bentley)
+
PERFORMANCE:
* Commit in quiet mode is now slightly faster as the information to
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py 2007-09-04 17:50:27 +0000
+++ b/bzrlib/config.py 2007-10-05 14:52:02 +0000
@@ -295,6 +295,15 @@
def _get_nickname(self):
return None
+ def get_bzr_remote_path(self):
+ try:
+ return os.environ['BZR_REMOTE_PATH']
+ except KeyError:
+ path = self.get_user_option("bzr_remote_path")
+ if path is None:
+ path = 'bzr'
+ return path
+
class IniBasedConfig(Config):
"""A configuration policy that draws from ini files."""
=== modified file 'bzrlib/smart/medium.py'
--- a/bzrlib/smart/medium.py 2007-07-31 21:20:02 +0000
+++ b/bzrlib/smart/medium.py 2007-10-05 14:52:02 +0000
@@ -28,7 +28,10 @@
import socket
import sys
-from bzrlib import errors
+from bzrlib import (
+ errors,
+ symbol_versioning,
+ )
from bzrlib.smart.protocol import (
REQUEST_VERSION_TWO,
SmartServerRequestProtocolOne,
@@ -443,7 +446,7 @@
"""A client medium using SSH."""
def __init__(self, host, port=None, username=None, password=None,
- vendor=None):
+ vendor=None, bzr_remote_path=None):
"""Creates a client that will connect on the first use.
:param vendor: An optional override for the ssh vendor to use. See
@@ -459,6 +462,12 @@
self._ssh_connection = None
self._vendor = vendor
self._write_to = None
+ self._bzr_remote_path = bzr_remote_path
+ if self._bzr_remote_path is None:
+ symbol_versioning.warn(
+ 'bzr_remote_path is required as of bzr 0.92',
+ DeprecationWarning, stacklevel=2)
+ self._bzr_remote_path = os.environ.get('BZR_REMOTE_PATH', 'bzr')
def _accept_bytes(self, bytes):
"""See SmartClientStreamMedium.accept_bytes."""
@@ -478,15 +487,14 @@
"""Connect this medium if not already connected."""
if self._connected:
return
- executable = os.environ.get('BZR_REMOTE_PATH', 'bzr')
if self._vendor is None:
vendor = ssh._get_ssh_vendor()
else:
vendor = self._vendor
self._ssh_connection = vendor.connect_ssh(self._username,
self._password, self._host, self._port,
- command=[executable, 'serve', '--inet', '--directory=/',
- '--allow-writes'])
+ command=[self._bzr_remote_path, 'serve', '--inet',
+ '--directory=/', '--allow-writes'])
self._read_from, self._write_to = \
self._ssh_connection.get_filelike_channels()
self._connected = True
=== modified file 'bzrlib/tests/test_config.py'
--- a/bzrlib/tests/test_config.py 2007-09-04 17:50:27 +0000
+++ b/bzrlib/tests/test_config.py 2007-10-05 14:52:02 +0000
@@ -887,6 +887,14 @@
self.my_config.set_user_option('foo', 'qux')
self.assertEqual(self.my_config.get_user_option('foo'), 'baz')
+ def test_get_bzr_remote_path(self):
+ my_config = config.LocationConfig('/a/c')
+ self.assertEqual('bzr', my_config.get_bzr_remote_path())
+ my_config.set_user_option('bzr_remote_path', '/path-bzr')
+ self.assertEqual('/path-bzr', my_config.get_bzr_remote_path())
+ os.environ['BZR_REMOTE_PATH'] = '/environ-bzr'
+ self.assertEqual('/environ-bzr', my_config.get_bzr_remote_path())
+
precedence_global = 'option = global'
precedence_branch = 'option = branch'
=== modified file 'bzrlib/tests/test_smart_transport.py'
--- a/bzrlib/tests/test_smart_transport.py 2007-10-03 02:56:16 +0000
+++ b/bzrlib/tests/test_smart_transport.py 2007-10-05 14:52:02 +0000
@@ -230,7 +230,8 @@
# having vendor be invalid means that if it tries to connect via the
# vendor it will blow up.
client_medium = medium.SmartSSHClientMedium('127.0.0.1', unopened_port,
- username=None, password=None, vendor="not a vendor")
+ username=None, password=None, vendor="not a vendor",
+ bzr_remote_path='bzr')
sock.close()
def test_ssh_client_connects_on_first_use(self):
@@ -239,7 +240,7 @@
output = StringIO()
vendor = StringIOSSHVendor(StringIO(), output)
client_medium = medium.SmartSSHClientMedium(
- 'a hostname', 'a port', 'a username', 'a password', vendor)
+ 'a hostname', 'a port', 'a username', 'a password', vendor, 'bzr')
client_medium._accept_bytes('abc')
self.assertEqual('abc', output.getvalue())
self.assertEqual([('connect_ssh', 'a username', 'a password',
@@ -257,7 +258,9 @@
osutils.set_or_unset_env('BZR_REMOTE_PATH', orig_bzr_remote_path)
self.addCleanup(cleanup_environ)
os.environ['BZR_REMOTE_PATH'] = 'fugly'
- client_medium = medium.SmartSSHClientMedium('a hostname', 'a port', 'a username',
+ client_medium = self.callDeprecated(
+ ['bzr_remote_path is required as of bzr 0.92'],
+ medium.SmartSSHClientMedium, 'a hostname', 'a port', 'a username',
'a password', vendor)
client_medium._accept_bytes('abc')
self.assertEqual('abc', output.getvalue())
@@ -266,13 +269,29 @@
['fugly', 'serve', '--inet', '--directory=/', '--allow-writes'])],
vendor.calls)
+ def test_ssh_client_changes_command_when_bzr_remote_path_passed(self):
+ # The only thing that initiates a connection from the medium is giving
+ # it bytes.
+ output = StringIO()
+ vendor = StringIOSSHVendor(StringIO(), output)
+ client_medium = medium.SmartSSHClientMedium('a hostname', 'a port',
+ 'a username', 'a password', vendor, bzr_remote_path='fugly')
+ client_medium._accept_bytes('abc')
+ self.assertEqual('abc', output.getvalue())
+ self.assertEqual([('connect_ssh', 'a username', 'a password',
+ 'a hostname', 'a port',
+ ['fugly', 'serve', '--inet', '--directory=/', '--allow-writes'])],
+ vendor.calls)
+
def test_ssh_client_disconnect_does_so(self):
# calling disconnect should disconnect both the read_from and write_to
# file-like object it from the ssh connection.
input = StringIO()
output = StringIO()
vendor = StringIOSSHVendor(input, output)
- client_medium = medium.SmartSSHClientMedium('a hostname', vendor=vendor)
+ client_medium = medium.SmartSSHClientMedium('a hostname',
+ vendor=vendor,
+ bzr_remote_path='bzr')
client_medium._accept_bytes('abc')
client_medium.disconnect()
self.assertTrue(input.closed)
@@ -292,7 +311,8 @@
input = StringIO()
output = StringIO()
vendor = StringIOSSHVendor(input, output)
- client_medium = medium.SmartSSHClientMedium('a hostname', vendor=vendor)
+ client_medium = medium.SmartSSHClientMedium('a hostname',
+ vendor=vendor, bzr_remote_path='bzr')
client_medium._accept_bytes('abc')
client_medium.disconnect()
# the disconnect has closed output, so we need a new output for the
@@ -320,15 +340,19 @@
def test_ssh_client_ignores_disconnect_when_not_connected(self):
# Doing a disconnect on a new (and thus unconnected) SSH medium
# does not fail. It's ok to disconnect an unconnected medium.
- client_medium = medium.SmartSSHClientMedium(None)
+ client_medium = medium.SmartSSHClientMedium(None,
+ bzr_remote_path='bzr')
client_medium.disconnect()
def test_ssh_client_raises_on_read_when_not_connected(self):
# Doing a read on a new (and thus unconnected) SSH medium raises
# MediumNotConnected.
- client_medium = medium.SmartSSHClientMedium(None)
- self.assertRaises(errors.MediumNotConnected, client_medium.read_bytes, 0)
- self.assertRaises(errors.MediumNotConnected, client_medium.read_bytes, 1)
+ client_medium = medium.SmartSSHClientMedium(None,
+ bzr_remote_path='bzr')
+ self.assertRaises(errors.MediumNotConnected, client_medium.read_bytes,
+ 0)
+ self.assertRaises(errors.MediumNotConnected, client_medium.read_bytes,
+ 1)
def test_ssh_client_supports__flush(self):
# invoking _flush on a SSHClientMedium should flush the output
@@ -341,7 +365,9 @@
def logging_flush(): flush_calls.append('flush')
output.flush = logging_flush
vendor = StringIOSSHVendor(input, output)
- client_medium = medium.SmartSSHClientMedium('a hostname', vendor=vendor)
+ client_medium = medium.SmartSSHClientMedium('a hostname',
+ vendor=vendor,
+ bzr_remote_path='bzr')
# this call is here to ensure we only flush once, not on every
# _accept_bytes call.
client_medium._accept_bytes('abc')
=== modified file 'bzrlib/transport/remote.py'
--- a/bzrlib/transport/remote.py 2007-10-04 05:09:58 +0000
+++ b/bzrlib/transport/remote.py 2007-10-05 14:52:02 +0000
@@ -27,6 +27,7 @@
import urlparse
from bzrlib import (
+ config,
debug,
errors,
trace,
@@ -466,8 +467,10 @@
# ssh will prompt the user for a password if needed and if none is
# provided but it will not give it back, so no credentials can be
# stored.
+ location_config = config.LocationConfig(self.base)
+ bzr_remote_path = location_config.get_bzr_remote_path()
return medium.SmartSSHClientMedium(self._host, self._port,
- self._user, self._password), None
+ self._user, self._password, bzr_remote_path=bzr_remote_path), None
class RemoteHTTPTransport(RemoteTransport):
=== modified file 'doc/en/user-guide/configuration.txt'
--- a/doc/en/user-guide/configuration.txt 2007-09-04 19:03:51 +0000
+++ b/doc/en/user-guide/configuration.txt 2007-10-05 14:52:02 +0000
@@ -188,6 +188,17 @@
gpg_signing_command = /usr/bin/gnpg
+bzr_remote_path
+---------------
+(Default: "bzr"). The path to the command that should be used to run the smart
+server for bzr. This value may only be specified in locations.conf, because:
+
+- it's needed before branch.conf is accessible
+- allowing remote branch.conf files to specify commands would be a security
+ risk
+
+It is overridden by the BZR_REMOTE_PATH environment variable.
+
smtp_server
-----------
(Default: "localhost"). SMTP server to use when Bazaar needs to send
More information about the bazaar-commits
mailing list