Show More
@@ -2868,6 +2868,10 b' def serve(ui, repo, **opts):' | |||
|
2868 | 2868 | By default, the server logs accesses to stdout and errors to |
|
2869 | 2869 | stderr. Use the -A/--accesslog and -E/--errorlog options to log to |
|
2870 | 2870 | files. |
|
2871 | ||
|
2872 | To have the server choose a free port number to listen on, specify | |
|
2873 | a port number of 0; in this case, the server will print the port | |
|
2874 | number it uses. | |
|
2871 | 2875 | """ |
|
2872 | 2876 | |
|
2873 | 2877 | if opts["stdio"]: |
@@ -2881,10 +2885,13 b' def serve(ui, repo, **opts):' | |||
|
2881 | 2885 | optlist = ("name templates style address port prefix ipv6" |
|
2882 | 2886 | " accesslog errorlog webdir_conf certificate encoding") |
|
2883 | 2887 | for o in optlist.split(): |
|
2884 | if opts.get(o, None): | |
|
2885 | baseui.setconfig("web", o, str(opts[o])) | |
|
2886 | if (repo is not None) and (repo.ui != baseui): | |
|
2887 | repo.ui.setconfig("web", o, str(opts[o])) | |
|
2888 | try: val = opts[o] | |
|
2889 | except KeyError: continue | |
|
2890 | else: | |
|
2891 | if val == '': continue | |
|
2892 | baseui.setconfig("web", o, val) | |
|
2893 | if repo and repo.ui != baseui: | |
|
2894 | repo.ui.setconfig("web", o, val) | |
|
2888 | 2895 | |
|
2889 | 2896 | if repo is None and not ui.config("web", "webdir_conf"): |
|
2890 | 2897 | raise error.RepoError(_("There is no Mercurial repository here" |
@@ -2895,7 +2902,7 b' def serve(ui, repo, **opts):' | |||
|
2895 | 2902 | util.set_signal_handler() |
|
2896 | 2903 | self.httpd = server.create_server(baseui, repo) |
|
2897 | 2904 | |
|
2898 | if not ui.verbose: | |
|
2905 | if opts['port'] and not ui.verbose: | |
|
2899 | 2906 | return |
|
2900 | 2907 | |
|
2901 | 2908 | if self.httpd.prefix: |
@@ -2916,8 +2923,12 b' def serve(ui, repo, **opts):' | |||
|
2916 | 2923 | fqaddr = self.httpd.fqaddr |
|
2917 | 2924 | if ':' in fqaddr: |
|
2918 | 2925 | fqaddr = '[%s]' % fqaddr |
|
2919 | ui.status(_('listening at http://%s%s/%s (bound to %s:%d)\n') % | |
|
2920 | (fqaddr, port, prefix, bindaddr, self.httpd.port)) | |
|
2926 | if opts['port']: | |
|
2927 | write = ui.status | |
|
2928 | else: | |
|
2929 | write = ui.write | |
|
2930 | write(_('listening at http://%s%s/%s (bound to %s:%d)\n') % | |
|
2931 | (fqaddr, port, prefix, bindaddr, self.httpd.port)) | |
|
2921 | 2932 | |
|
2922 | 2933 | def run(self): |
|
2923 | 2934 | self.httpd.serve_forever() |
@@ -3771,7 +3782,7 b' table = {' | |||
|
3771 | 3782 | ('d', 'daemon', None, _('run server in background')), |
|
3772 | 3783 | ('', 'daemon-pipefds', '', _('used internally by daemon mode')), |
|
3773 | 3784 | ('E', 'errorlog', '', _('name of error log file to write to')), |
|
3774 | ('p', 'port', 0, _('port to listen on (default: 8000)')), | |
|
3785 | ('p', 'port', 8000, _('port to listen on (default: 8000)')), | |
|
3775 | 3786 | ('a', 'address', '', |
|
3776 | 3787 | _('address to listen on (default: all interfaces)')), |
|
3777 | 3788 | ('', 'prefix', '', |
General Comments 0
You need to be logged in to leave comments.
Login now