~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

Support bzr:// urls to work with the new RPC-based transport which will be used
with the upcoming high-performance smart server. The new command ``bzr serve``
will invoke bzr in server mode, which processes these requests. (Andrew
Bennetts, Robert Collins, Martin Pool)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2742
2742
            pass
2743
2743
        
2744
2744
 
 
2745
class cmd_serve(Command):
 
2746
    """Run the bzr server.
 
2747
    """
 
2748
    takes_options = [
 
2749
        Option('inet',
 
2750
               help='serve on stdin/out for use from inetd or sshd'),
 
2751
        Option('port',
 
2752
               help='listen for connections on nominated port',
 
2753
               type=int),
 
2754
        Option('directory',
 
2755
               help='serve contents of directory',
 
2756
               type=unicode),
 
2757
        ]
 
2758
 
 
2759
    def run(self, port=None, inet=False, directory=None):
 
2760
        from bzrlib.transport import smart
 
2761
        from bzrlib.transport import get_transport
 
2762
        if directory is None:
 
2763
            directory = os.getcwd()
 
2764
        t = get_transport(directory)
 
2765
        if inet:
 
2766
            server = smart.SmartStreamServer(sys.stdin, sys.stdout, t)
 
2767
        elif port is not None:
 
2768
            server = smart.SmartTCPServer(t, port=port)
 
2769
        server.serve()
 
2770
 
2745
2771
 
2746
2772
# command-line interpretation helper for merge-related commands
2747
2773
def merge(other_revision, base_revision,