~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-09-19 03:52:02 UTC
  • mfrom: (2018.1.11 bzr+ssh:// testing)
  • Revision ID: pqm@pqm.ubuntu.com-20060919035202-8174b4dc7ff91add
(Andrew Bennetts, Robert Collins) Add bzr+ssh:// url support and turn the smart server into a anonymous readonly server by default.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2782
2782
 
2783
2783
 
2784
2784
class cmd_serve(Command):
2785
 
    """Run the bzr server.
2786
 
    """
 
2785
    """Run the bzr server."""
 
2786
 
 
2787
    aliases = ['server']
 
2788
 
2787
2789
    takes_options = [
2788
2790
        Option('inet',
2789
2791
               help='serve on stdin/out for use from inetd or sshd'),
2795
2797
        Option('directory',
2796
2798
               help='serve contents of directory',
2797
2799
               type=unicode),
 
2800
        Option('allow-writes',
 
2801
               help='By default the server is a readonly server. Supplying '
 
2802
                    '--allow-writes enables write access to the contents of '
 
2803
                    'the served directory and below. '
 
2804
                ),
2798
2805
        ]
2799
2806
 
2800
 
    def run(self, port=None, inet=False, directory=None):
 
2807
    def run(self, port=None, inet=False, directory=None, allow_writes=False):
2801
2808
        from bzrlib.transport import smart
2802
2809
        from bzrlib.transport import get_transport
2803
2810
        if directory is None:
2804
2811
            directory = os.getcwd()
2805
 
        t = get_transport(directory)
 
2812
        url = 'file://' + urlutils.escape(directory)
 
2813
        if not allow_writes:
 
2814
            url = 'readonly+' + url
 
2815
        t = get_transport(url)
2806
2816
        if inet:
2807
2817
            server = smart.SmartStreamServer(sys.stdin, sys.stdout, t)
2808
2818
        elif port is not None: