Show More
@@ -2461,10 +2461,7 b' def serve(ui, repo, **opts):' | |||
|
2461 | 2461 | class service: |
|
2462 | 2462 | def init(self): |
|
2463 | 2463 | util.set_signal_handler() |
|
2464 | try: | |
|
2465 | self.httpd = hgweb.server.create_server(parentui, repo) | |
|
2466 | except socket.error, inst: | |
|
2467 | raise util.Abort(_('cannot start server: ') + inst.args[1]) | |
|
2464 | self.httpd = hgweb.server.create_server(parentui, repo) | |
|
2468 | 2465 | |
|
2469 | 2466 | if not ui.verbose: return |
|
2470 | 2467 | |
@@ -2473,12 +2470,12 b' def serve(ui, repo, **opts):' | |||
|
2473 | 2470 | else: |
|
2474 | 2471 | prefix = '' |
|
2475 | 2472 | |
|
2476 |
|
|
|
2477 | ui.status(_('listening at http://%s:%d/%s\n') % | |
|
2478 | (self.httpd.addr, self.httpd.port, prefix)) | |
|
2479 | else: | |
|
2480 |
|
|
|
2481 |
|
|
|
2473 | port = ':%d' % self.httpd.port | |
|
2474 | if port == ':80': | |
|
2475 | port = '' | |
|
2476 | ||
|
2477 | ui.status(_('listening at http://%s%s/%s (%s:%d)\n') % | |
|
2478 | (self.httpd.fqaddr, port, prefix, self.httpd.addr, self.httpd.port)) | |
|
2482 | 2479 | |
|
2483 | 2480 | def run(self): |
|
2484 | 2481 | self.httpd.serve_forever() |
@@ -3115,8 +3112,8 b' table = {' | |||
|
3115 | 3112 | ('d', 'daemon', None, _('run server in background')), |
|
3116 | 3113 | ('', 'daemon-pipefds', '', _('used internally by daemon mode')), |
|
3117 | 3114 | ('E', 'errorlog', '', _('name of error log file to write to')), |
|
3118 |
('p', 'port', 0, _('port to |
|
|
3119 |
('a', 'address', '', _('address to |
|
|
3115 | ('p', 'port', 0, _('port to listen on (default: 8000)')), | |
|
3116 | ('a', 'address', '', _('address to listen on (default: all interfaces)')), | |
|
3120 | 3117 | ('', 'prefix', '', _('prefix path to serve from (default: server root)')), |
|
3121 | 3118 | ('n', 'name', '', |
|
3122 | 3119 | _('name to show in web pages (default: working dir)')), |
@@ -253,13 +253,6 b' def create_server(ui, repo):' | |||
|
253 | 253 | return hgwebobj |
|
254 | 254 | self.application = make_handler() |
|
255 | 255 | |
|
256 | addr = address | |
|
257 | if addr in ('', '::'): | |
|
258 | addr = socket.gethostname() | |
|
259 | ||
|
260 | self.addr, self.port = addr, port | |
|
261 | self.prefix = prefix | |
|
262 | ||
|
263 | 256 | if ssl_cert: |
|
264 | 257 | try: |
|
265 | 258 | from OpenSSL import SSL |
@@ -273,6 +266,15 b' def create_server(ui, repo):' | |||
|
273 | 266 | self.server_bind() |
|
274 | 267 | self.server_activate() |
|
275 | 268 | |
|
269 | self.addr, self.port = self.socket.getsockname()[0:2] | |
|
270 | self.prefix = prefix | |
|
271 | ||
|
272 | self.fqaddr = socket.getfqdn(address) | |
|
273 | try: | |
|
274 | socket.getaddrbyhost(self.fqaddr) | |
|
275 | except: | |
|
276 | fqaddr = address | |
|
277 | ||
|
276 | 278 | class IPv6HTTPServer(MercurialHTTPServer): |
|
277 | 279 | address_family = getattr(socket, 'AF_INET6', None) |
|
278 | 280 | |
@@ -292,4 +294,5 b' def create_server(ui, repo):' | |||
|
292 | 294 | else: |
|
293 | 295 | return MercurialHTTPServer((address, port), handler) |
|
294 | 296 | except socket.error, inst: |
|
295 |
raise util.Abort(_(' |
|
|
297 | raise util.Abort(_("cannot start server at '%s:%d': %s") | |
|
298 | % (address, port, inst.args[1])) |
@@ -9,7 +9,7 b" hg commit -A -d '0 0' -m 1" | |||
|
9 | 9 | hg --config server.uncompressed=True serve -p $HGPORT -d --pid-file=../hg1.pid |
|
10 | 10 | hg serve -p $HGPORT1 -d --pid-file=../hg2.pid |
|
11 | 11 | # Test server address cannot be reused |
|
12 |
hg serve -p $HGPORT1 2>&1 | sed -e |
|
|
12 | hg serve -p $HGPORT1 2>&1 | sed -e "s/abort: cannot start server at ':$HGPORT1':.*/abort: cannot start server at ':$HGPORT1':/" | |
|
13 | 13 | cd .. |
|
14 | 14 | cat hg1.pid hg2.pid >> $DAEMON_PIDS |
|
15 | 15 |
@@ -1,5 +1,5 b'' | |||
|
1 | 1 | adding foo |
|
2 | abort: cannot start server: | |
|
2 | abort: cannot start server at ':20060': | |
|
3 | 3 | % clone via stream |
|
4 | 4 | streaming all changes |
|
5 | 5 | XXX files to transfer, XXX bytes of data |
@@ -14,33 +14,38 b' if [ -f access.log ]; then' | |||
|
14 | 14 | fi |
|
15 | 15 | |
|
16 | 16 | echo % With -v |
|
17 |
hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -v |
|
|
17 | hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -v \ | |
|
18 | | sed -e 's/:[0-9][0-9]*//g' -e 's/localhost\.localdomain/localhost/' | |
|
18 | 19 | cat hg.pid >> "$DAEMON_PIDS" |
|
19 | 20 | sleep 1 |
|
20 | 21 | kill `cat hg.pid` |
|
21 | 22 | sleep 1 |
|
22 | 23 | |
|
23 | 24 | echo % With --prefix foo |
|
24 |
hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -v --prefix foo |
|
|
25 | hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -v --prefix foo \ | |
|
26 | | sed -e 's/:[0-9][0-9]*//g' -e 's/localhost\.localdomain/localhost/' | |
|
25 | 27 | cat hg.pid >> "$DAEMON_PIDS" |
|
26 | 28 | sleep 1 |
|
27 | 29 | kill `cat hg.pid` |
|
28 | 30 | sleep 1 |
|
29 | 31 | |
|
30 | 32 | echo % With --prefix /foo |
|
31 |
hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -v --prefix /foo |
|
|
33 | hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -v --prefix /foo \ | |
|
34 | | sed -e 's/:[0-9][0-9]*//g' -e 's/localhost\.localdomain/localhost/' | |
|
32 | 35 | cat hg.pid >> "$DAEMON_PIDS" |
|
33 | 36 | sleep 1 |
|
34 | 37 | kill `cat hg.pid` |
|
35 | 38 | sleep 1 |
|
36 | 39 | |
|
37 | 40 | echo % With --prefix foo/ |
|
38 |
hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -v --prefix foo/ |
|
|
41 | hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -v --prefix foo/ \ | |
|
42 | | sed -e 's/:[0-9][0-9]*//g' -e 's/localhost\.localdomain/localhost/' | |
|
39 | 43 | cat hg.pid >> "$DAEMON_PIDS" |
|
40 | 44 | sleep 1 |
|
41 | 45 | kill `cat hg.pid` |
|
42 | 46 | sleep 1 |
|
43 | 47 | |
|
44 | 48 | echo % With --prefix /foo/ |
|
45 |
hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -v --prefix /foo/ |
|
|
49 | hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -v --prefix /foo/ \ | |
|
50 | | sed -e 's/:[0-9][0-9]*//g' -e 's/localhost\.localdomain/localhost/' | |
|
46 | 51 | cat hg.pid >> "$DAEMON_PIDS" |
@@ -1,12 +1,12 b'' | |||
|
1 | 1 | % Without -v |
|
2 | 2 | access log created - .hg/hgrc respected |
|
3 | 3 | % With -v |
|
4 | listening at http://localhost/ | |
|
4 | listening at http://localhost/ (127.0.0.1) | |
|
5 | 5 | % With --prefix foo |
|
6 | listening at http://localhost/foo/ | |
|
6 | listening at http://localhost/foo/ (127.0.0.1) | |
|
7 | 7 | % With --prefix /foo |
|
8 | listening at http://localhost/foo/ | |
|
8 | listening at http://localhost/foo/ (127.0.0.1) | |
|
9 | 9 | % With --prefix foo/ |
|
10 | listening at http://localhost/foo/ | |
|
10 | listening at http://localhost/foo/ (127.0.0.1) | |
|
11 | 11 | % With --prefix /foo/ |
|
12 | listening at http://localhost/foo/ | |
|
12 | listening at http://localhost/foo/ (127.0.0.1) |
General Comments 0
You need to be logged in to leave comments.
Login now