Rev 6480: (jelmer) Split the --port option into --listen and --port. (Ross Lagerwall) in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/
Patch Queue Manager
pqm at pqm.ubuntu.com
Sun Mar 4 18:47:59 UTC 2012
At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 6480 [merge]
revision-id: pqm at pqm.ubuntu.com-20120304184759-kpae3rpzzscn4vjm
parent: pqm at pqm.ubuntu.com-20120304182104-8y1tdavoblrrhflc
parent: rosslagerwall at gmail.com-20120224202548-yvz0hy5hv5i4ittc
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sun 2012-03-04 18:47:59 +0000
message:
(jelmer) Split the --port option into --listen and --port. (Ross Lagerwall)
modified:
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/tests/blackbox/test_serve.py test_serve.py-20060913064329-8t2pvmsikl4s3xhl-1
contrib/debian/default default-20090902043124-q9z6vubije18w0hp-1
doc/en/user-guide/server.txt server.txt-20060913044801-h939fvbwzz39gf7g-1
doc/ja/user-guide/server.txt server.txt-20091029100035-1rni8rgpen0pe1g2-58
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2012-02-20 12:40:02 +0000
+++ b/bzrlib/builtins.py 2012-02-24 20:15:34 +0000
@@ -5479,12 +5479,13 @@
help="Protocol to serve.",
lazy_registry=('bzrlib.transport', 'transport_server_registry'),
value_switches=True),
+ Option('listen',
+ help='Listen for connections on nominated address.', type=str),
Option('port',
- help='Listen for connections on nominated port of the form '
- '[hostname:]portnumber. Passing 0 as the port number will '
- 'result in a dynamically allocated port. The default port '
- 'depends on the protocol.',
- type=str),
+ help='Listen for connections on nominated port. Passing 0 as '
+ 'the port number will result in a dynamically allocated '
+ 'port. The default port depends on the protocol.',
+ type=int),
custom_help('directory',
help='Serve contents of this directory.'),
Option('allow-writes',
@@ -5500,39 +5501,19 @@
help='Override the default idle client timeout (5min).'),
]
- def get_host_and_port(self, port):
- """Return the host and port to run the smart server on.
-
- If 'port' is None, None will be returned for the host and port.
-
- If 'port' has a colon in it, the string before the colon will be
- interpreted as the host.
-
- :param port: A string of the port to run the server on.
- :return: A tuple of (host, port), where 'host' is a host name or IP,
- and port is an integer TCP/IP port.
- """
- host = None
- if port is not None:
- if ':' in port:
- host, port = port.split(':')
- port = int(port)
- return host, port
-
- def run(self, port=None, inet=False, directory=None, allow_writes=False,
- protocol=None, client_timeout=None):
+ def run(self, listen=None, port=None, inet=False, directory=None,
+ allow_writes=False, protocol=None, client_timeout=None):
from bzrlib import transport
if directory is None:
directory = os.getcwd()
if protocol is None:
protocol = transport.transport_server_registry.get()
- host, port = self.get_host_and_port(port)
url = transport.location_to_url(directory)
if not allow_writes:
url = 'readonly+' + url
t = transport.get_transport_from_url(url)
try:
- protocol(t, host, port, inet, client_timeout)
+ protocol(t, listen, port, inet, client_timeout)
except TypeError, e:
# We use symbol_versioning.deprecated_in just so that people
# grepping can find it here.
=== modified file 'bzrlib/tests/blackbox/test_serve.py'
--- a/bzrlib/tests/blackbox/test_serve.py 2011-11-01 18:40:39 +0000
+++ b/bzrlib/tests/blackbox/test_serve.py 2012-02-24 20:22:06 +0000
@@ -122,7 +122,7 @@
SmartTCPServer.hooks.install_named_hook(
'server_exception', hook,
'test_server_except_hook hook')
- args = ['--port', 'localhost:0', '--quiet']
+ args = ['--listen', 'localhost', '--port', '0', '--quiet']
out, err = self.run_bzr_serve_then_func(args, retcode=0)
self.assertEqual('catching KeyboardInterrupt\n', err)
@@ -190,7 +190,7 @@
finish_bzr_subprocess, and the base url for the server.
"""
# Serve from the current directory
- args = ['serve', '--port', 'localhost:0']
+ args = ['serve', '--listen', 'localhost', '--port', '0']
args.extend(extra_options)
process = self.start_bzr_subprocess(args, skip_if_plan_to_signal=True)
port_line = process.stderr.readline()
@@ -203,7 +203,7 @@
def test_bzr_serve_quiet(self):
self.make_branch('.')
- args = ['--port', 'localhost:0', '--quiet']
+ args = ['--listen', 'localhost', '--port', '0', '--quiet']
out, err = self.run_bzr_serve_then_func(args, retcode=3)
self.assertEqual('', out)
self.assertEqual('', err)
@@ -354,7 +354,7 @@
t = self.get_transport()
t.mkdir('server-root')
self.run_bzr_serve_then_func(
- ['--port', '127.0.0.1:0',
+ ['--listen', 'localhost', '--port', '0',
'--directory', t.local_abspath('server-root'),
'--allow-writes'],
func=self.when_server_started)
=== modified file 'contrib/debian/default'
--- a/contrib/debian/default 2009-09-03 00:36:15 +0000
+++ b/contrib/debian/default 2012-02-24 20:25:48 +0000
@@ -16,5 +16,5 @@
# Other arguments
# Add --allow-writes for RW access
-# Example config listens on localhost
-DAEMON_ARGS="--port=127.0.0.1:4155"
+# Example config listens on localhost and default port
+DAEMON_ARGS="--listen=127.0.0.1"
=== modified file 'doc/en/user-guide/server.txt'
--- a/doc/en/user-guide/server.txt 2010-11-12 22:46:28 +0000
+++ b/doc/en/user-guide/server.txt 2012-02-24 20:25:48 +0000
@@ -97,7 +97,7 @@
server::
- bzr serve --port=localhost:1234 --directory=/srv/bzr/repo
+ bzr serve --listen=localhost --port=1234 --directory=/srv/bzr/repo
client::
=== modified file 'doc/ja/user-guide/server.txt'
--- a/doc/ja/user-guide/server.txt 2011-05-18 06:01:08 +0000
+++ b/doc/ja/user-guide/server.txt 2012-02-24 20:25:48 +0000
@@ -100,7 +100,7 @@
ãµã¼ãã¼::
- bzr serve --port=localhost:1234 --directory=/srv/bzr/repo
+ bzr serve --listen=localhost --port=1234 --directory=/srv/bzr/repo
ã¯ã©ã¤ã¢ã³ã::
More information about the bazaar-commits
mailing list