Show More
@@ -4786,7 +4786,8 b' def root(ui, repo):' | |||
|
4786 | 4786 | ('t', 'templates', '', _('web templates to use'), _('TEMPLATE')), |
|
4787 | 4787 | ('', 'style', '', _('template style to use'), _('STYLE')), |
|
4788 | 4788 | ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')), |
|
4789 |
('', 'certificate', '', _('SSL certificate file'), _('FILE')) |
|
|
4789 | ('', 'certificate', '', _('SSL certificate file'), _('FILE')), | |
|
4790 | ('', 'print-url', None, _('start and print only the URL'))] | |
|
4790 | 4791 | + subrepoopts, |
|
4791 | 4792 | _('[OPTION]...'), |
|
4792 | 4793 | optionalrepo=True) |
@@ -4818,6 +4819,10 b' def serve(ui, repo, **opts):' | |||
|
4818 | 4819 | opts = pycompat.byteskwargs(opts) |
|
4819 | 4820 | if opts["stdio"] and opts["cmdserver"]: |
|
4820 | 4821 | raise error.Abort(_("cannot use --stdio with --cmdserver")) |
|
4822 | if opts["print_url"] and ui.verbose: | |
|
4823 | raise error.Abort(_("cannot use --print-url with --verbose")) | |
|
4824 | if opts["print_url"]: | |
|
4825 | opts['daemon'] = True | |
|
4821 | 4826 | |
|
4822 | 4827 | if opts["stdio"]: |
|
4823 | 4828 | if repo is None: |
@@ -57,7 +57,9 b' class httpservice(object):' | |||
|
57 | 57 | procutil.setsignalhandler() |
|
58 | 58 | self.httpd = server.create_server(self.ui, self.app) |
|
59 | 59 | |
|
60 |
if self.opts['port'] and |
|
|
60 | if (self.opts['port'] and | |
|
61 | not self.ui.verbose and | |
|
62 | not self.opts['print_url']): | |
|
61 | 63 | return |
|
62 | 64 | |
|
63 | 65 | if self.httpd.prefix: |
@@ -78,13 +80,18 b' class httpservice(object):' | |||
|
78 | 80 | fqaddr = self.httpd.fqaddr |
|
79 | 81 | if r':' in fqaddr: |
|
80 | 82 | fqaddr = r'[%s]' % fqaddr |
|
81 | if self.opts['port']: | |
|
82 | write = self.ui.status | |
|
83 | ||
|
84 | url = 'http://%s%s/%s' % ( | |
|
85 | pycompat.sysbytes(fqaddr), pycompat.sysbytes(port), prefix) | |
|
86 | if self.opts['print_url']: | |
|
87 | self.ui.write('%s\n' % url) | |
|
83 | 88 | else: |
|
84 |
|
|
|
85 | write(_('listening at http://%s%s/%s (bound to %s:%d)\n') % | |
|
86 | (pycompat.sysbytes(fqaddr), pycompat.sysbytes(port), | |
|
87 | prefix, pycompat.sysbytes(bindaddr), self.httpd.port)) | |
|
89 | if self.opts['port']: | |
|
90 | write = self.ui.status | |
|
91 | else: | |
|
92 | write = self.ui.write | |
|
93 | write(_('listening at %s (bound to %s:%d)\n') % | |
|
94 | (url, pycompat.sysbytes(bindaddr), self.httpd.port)) | |
|
88 | 95 | self.ui.flush() # avoid buffering of status message |
|
89 | 96 | |
|
90 | 97 | def run(self): |
@@ -191,6 +191,7 b' Show the options for the "serve" command' | |||
|
191 | 191 | --pid-file |
|
192 | 192 | --port |
|
193 | 193 | --prefix |
|
194 | --print-url | |
|
194 | 195 | --profile |
|
195 | 196 | --quiet |
|
196 | 197 | --repository |
@@ -239,7 +240,7 b' Show all commands + options' | |||
|
239 | 240 | pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure |
|
240 | 241 | push: force, rev, bookmark, branch, new-branch, pushvars, ssh, remotecmd, insecure |
|
241 | 242 | remove: after, force, subrepos, include, exclude, dry-run |
|
242 | serve: accesslog, daemon, daemon-postexec, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate, subrepos | |
|
243 | serve: accesslog, daemon, daemon-postexec, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate, print-url, subrepos | |
|
243 | 244 | status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, terse, copies, print0, rev, change, include, exclude, subrepos, template |
|
244 | 245 | summary: remote |
|
245 | 246 | update: clean, check, merge, date, rev, tool |
General Comments 0
You need to be logged in to leave comments.
Login now