2781
2781
sys.stdin.readline()
2784
class cmd_serve(Command):
2785
"""Run the bzr server.
2789
help='serve on stdin/out for use from inetd or sshd'),
2791
help='listen for connections on nominated port of the form '
2792
'[hostname:]portnumber. Passing 0 as the port number will '
2793
'result in a dynamically allocated port.',
2796
help='serve contents of directory',
2800
def run(self, port=None, inet=False, directory=None):
2801
from bzrlib.transport import smart
2802
from bzrlib.transport import get_transport
2803
if directory is None:
2804
directory = os.getcwd()
2805
t = get_transport(directory)
2807
server = smart.SmartStreamServer(sys.stdin, sys.stdout, t)
2808
elif port is not None:
2810
host, port = port.split(':')
2813
server = smart.SmartTCPServer(t, host=host, port=int(port))
2814
print 'listening on port: ', server.port
2817
raise BzrCommandError("bzr serve requires one of --inet or --port")
2784
2821
# command-line interpretation helper for merge-related commands
2785
2822
def merge(other_revision, base_revision,
2786
2823
check_clean=True, ignore_zero=False,