equal
deleted
inserted
replaced
2493 By default, the server logs accesses to stdout and errors to |
2493 By default, the server logs accesses to stdout and errors to |
2494 stderr. Use the "-A" and "-E" options to log to files. |
2494 stderr. Use the "-A" and "-E" options to log to files. |
2495 """ |
2495 """ |
2496 |
2496 |
2497 if opts["stdio"]: |
2497 if opts["stdio"]: |
|
2498 if repo is None: |
|
2499 raise hg.RepoError(_('no repo found')) |
2498 fin, fout = sys.stdin, sys.stdout |
2500 fin, fout = sys.stdin, sys.stdout |
2499 sys.stdout = sys.stderr |
2501 sys.stdout = sys.stderr |
2500 |
2502 |
2501 # Prevent insertion/deletion of CRs |
2503 # Prevent insertion/deletion of CRs |
2502 util.set_binary(fin) |
2504 util.set_binary(fin) |
2570 " accesslog errorlog webdir_conf") |
2572 " accesslog errorlog webdir_conf") |
2571 for o in optlist.split(): |
2573 for o in optlist.split(): |
2572 if opts[o]: |
2574 if opts[o]: |
2573 ui.setconfig("web", o, opts[o]) |
2575 ui.setconfig("web", o, opts[o]) |
2574 |
2576 |
|
2577 if repo is None and not ui.config("web", "webdir_conf"): |
|
2578 raise hg.RepoError(_('no repo found')) |
|
2579 |
2575 if opts['daemon'] and not opts['daemon_pipefds']: |
2580 if opts['daemon'] and not opts['daemon_pipefds']: |
2576 rfd, wfd = os.pipe() |
2581 rfd, wfd = os.pipe() |
2577 args = sys.argv[:] |
2582 args = sys.argv[:] |
2578 args.append('--daemon-pipefds=%d,%d' % (rfd, wfd)) |
2583 args.append('--daemon-pipefds=%d,%d' % (rfd, wfd)) |
2579 pid = os.spawnvp(os.P_NOWAIT | getattr(os, 'P_DETACH', 0), |
2584 pid = os.spawnvp(os.P_NOWAIT | getattr(os, 'P_DETACH', 0), |
2581 os.close(wfd) |
2586 os.close(wfd) |
2582 os.read(rfd, 1) |
2587 os.read(rfd, 1) |
2583 os._exit(0) |
2588 os._exit(0) |
2584 |
2589 |
2585 try: |
2590 try: |
2586 httpd = hgweb.create_server(repo) |
2591 httpd = hgweb.create_server(ui, repo) |
2587 except socket.error, inst: |
2592 except socket.error, inst: |
2588 raise util.Abort(_('cannot start server: ') + inst.args[1]) |
2593 raise util.Abort(_('cannot start server: ') + inst.args[1]) |
2589 |
2594 |
2590 if ui.verbose: |
2595 if ui.verbose: |
2591 addr, port = httpd.socket.getsockname() |
2596 addr, port = httpd.socket.getsockname() |
3200 ('h', 'help', None, _('display help and exit')), |
3205 ('h', 'help', None, _('display help and exit')), |
3201 ] |
3206 ] |
3202 |
3207 |
3203 norepo = ("clone init version help debugancestor debugcomplete debugdata" |
3208 norepo = ("clone init version help debugancestor debugcomplete debugdata" |
3204 " debugindex debugindexdot") |
3209 " debugindex debugindexdot") |
3205 optionalrepo = ("paths debugconfig") |
3210 optionalrepo = ("paths serve debugconfig") |
3206 |
3211 |
3207 def findpossible(cmd): |
3212 def findpossible(cmd): |
3208 """ |
3213 """ |
3209 Return cmd -> (aliases, command table entry) |
3214 Return cmd -> (aliases, command table entry) |
3210 for each matching command. |
3215 for each matching command. |