# HG changeset patch # User Steve Losh # Date 1269706924 14400 # Node ID 048ef4889301111fc8bd308f12fd46d3a37adf82 # Parent ac324e064f827619fe06683926916648a0372013 Add --address and --port options for the web UI. You can now make the web interface listen on a specific address and/or port: hg review --web --address '0.0.0.0' --port 21333 By default it will listen on 127.0.0.1:8080 (disallowing external connections). diff -r ac324e064f82 -r 048ef4889301 review/extension_ui.py --- a/review/extension_ui.py Sat Mar 27 12:11:12 2010 -0400 +++ b/review/extension_ui.py Sat Mar 27 12:22:04 2010 -0400 @@ -16,9 +16,15 @@ def _web_command(ui, repo, **opts): ui.note(messages.WEB_START) read_only = opts.pop('read_only') + address = opts.pop('address') + port = int(opts.pop('port')) import web_ui - web_ui.load_interface(ui, repo, read_only=read_only, open=False) + web_ui.load_interface( + ui, repo, read_only=read_only, + address=address, port=port, + open=False + ) def _init_command(ui, repo, **opts): ui.note(messages.INIT_START) @@ -305,6 +311,8 @@ ('U', 'unified', '5', 'number of lines of context to show'), ('w', 'web', False, 'launch the web interface'), ('', 'read-only', False, 'make the web interface read-only'), + ('', 'address', '127.0.0.1', 'run the web interface on the specified address'), + ('', 'port', '8080', 'run the web interface on the specified port'), ], 'hg review') } diff -r ac324e064f82 -r 048ef4889301 review/web_ui.py --- a/review/web_ui.py Sat Mar 27 12:11:12 2010 -0400 +++ b/review/web_ui.py Sat Mar 27 12:22:04 2010 -0400 @@ -128,7 +128,7 @@ -def load_interface(ui, repo, read_only=False, open=False, port=8080): +def load_interface(ui, repo, read_only=False, open=False, address='127.0.0.1', port=8080): if open: import webbrowser webbrowser.open('http://localhost:%d/' % port) @@ -137,6 +137,10 @@ '/media': { 'tools.staticdir.on': True, 'tools.staticdir.dir': media_path, + }, + 'global': { + 'server.socket_host': address, + 'server.socket_port': port, } }