equal
deleted
inserted
replaced
9 from node import * |
9 from node import * |
10 from i18n import gettext as _ |
10 from i18n import gettext as _ |
11 demandload(globals(), "os re sys signal shutil imp urllib pdb shlex") |
11 demandload(globals(), "os re sys signal shutil imp urllib pdb shlex") |
12 demandload(globals(), "fancyopts ui hg util lock revlog templater bundlerepo") |
12 demandload(globals(), "fancyopts ui hg util lock revlog templater bundlerepo") |
13 demandload(globals(), "difflib patch tempfile time") |
13 demandload(globals(), "difflib patch tempfile time") |
14 demandload(globals(), "traceback errno socket version atexit sets bz2") |
14 demandload(globals(), "traceback errno version atexit sets bz2") |
15 demandload(globals(), "archival changegroup cmdutil hgweb.server sshserver") |
15 demandload(globals(), "archival changegroup cmdutil hgweb.server sshserver") |
16 |
16 |
17 class UnknownCommand(Exception): |
17 class UnknownCommand(Exception): |
18 """Exception raised if command is not in the command table.""" |
18 """Exception raised if command is not in the command table.""" |
19 class AmbiguousCommand(Exception): |
19 class AmbiguousCommand(Exception): |
2529 args[0], args) |
2529 args[0], args) |
2530 os.close(wfd) |
2530 os.close(wfd) |
2531 os.read(rfd, 1) |
2531 os.read(rfd, 1) |
2532 os._exit(0) |
2532 os._exit(0) |
2533 |
2533 |
2534 try: |
2534 httpd = hgweb.server.create_server(ui, repo) |
2535 httpd = hgweb.server.create_server(ui, repo) |
|
2536 except socket.error, inst: |
|
2537 raise util.Abort(_('cannot start server: %s') % inst.args[1]) |
|
2538 |
2535 |
2539 if ui.verbose: |
2536 if ui.verbose: |
2540 addr, port = httpd.socket.getsockname() |
2537 if httpd.port != 80: |
2541 if addr == '0.0.0.0': |
2538 ui.status(_('listening at http://%s:%d/\n') % |
2542 addr = socket.gethostname() |
2539 (httpd.addr, httpd.port)) |
2543 else: |
2540 else: |
2544 try: |
2541 ui.status(_('listening at http://%s/\n') % httpd.addr) |
2545 addr = socket.gethostbyaddr(addr)[0] |
|
2546 except socket.error: |
|
2547 pass |
|
2548 if port != 80: |
|
2549 ui.status(_('listening at http://%s:%d/\n') % (addr, port)) |
|
2550 else: |
|
2551 ui.status(_('listening at http://%s/\n') % addr) |
|
2552 |
2542 |
2553 if opts['pid_file']: |
2543 if opts['pid_file']: |
2554 fp = open(opts['pid_file'], 'w') |
2544 fp = open(opts['pid_file'], 'w') |
2555 fp.write(str(os.getpid()) + '\n') |
2545 fp.write(str(os.getpid()) + '\n') |
2556 fp.close() |
2546 fp.close() |