Show More
@@ -2495,6 +2495,8 def serve(ui, repo, **opts): | |||||
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 | |||
@@ -2572,6 +2574,9 def serve(ui, repo, **opts): | |||||
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[:] | |
@@ -2583,7 +2588,7 def serve(ui, repo, **opts): | |||||
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 | |||
@@ -3202,7 +3207,7 globalopts = [ | |||||
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 | """ |
@@ -889,7 +889,7 class hgweb(object): | |||||
889 | else: |
|
889 | else: | |
890 | req.write(self.t("error")) |
|
890 | req.write(self.t("error")) | |
891 |
|
891 | |||
892 | def create_server(repo): |
|
892 | def create_server(ui, repo): | |
893 | use_threads = True |
|
893 | use_threads = True | |
894 |
|
894 | |||
895 | def openlog(opt, default): |
|
895 | def openlog(opt, default): | |
@@ -897,12 +897,12 def create_server(repo): | |||||
897 | return open(opt, 'w') |
|
897 | return open(opt, 'w') | |
898 | return default |
|
898 | return default | |
899 |
|
899 | |||
900 |
address = |
|
900 | address = ui.config("web", "address", "") | |
901 |
port = int( |
|
901 | port = int(ui.config("web", "port", 8000)) | |
902 |
use_ipv6 = |
|
902 | use_ipv6 = ui.configbool("web", "ipv6") | |
903 |
webdir_conf = |
|
903 | webdir_conf = ui.config("web", "webdir_conf") | |
904 |
accesslog = openlog( |
|
904 | accesslog = openlog(ui.config("web", "accesslog", "-"), sys.stdout) | |
905 |
errorlog = openlog( |
|
905 | errorlog = openlog(ui.config("web", "errorlog", "-"), sys.stderr) | |
906 |
|
906 | |||
907 | if use_threads: |
|
907 | if use_threads: | |
908 | try: |
|
908 | try: | |
@@ -988,8 +988,10 def create_server(repo): | |||||
988 |
|
988 | |||
989 | if webdir_conf: |
|
989 | if webdir_conf: | |
990 | hgwebobj = hgwebdir(webdir_conf) |
|
990 | hgwebobj = hgwebdir(webdir_conf) | |
|
991 | elif repo is not None: | |||
|
992 | hgwebobj = hgweb(repo.__class__(repo.ui, repo.origroot)) | |||
991 | else: |
|
993 | else: | |
992 | hgwebobj = hgweb(repo.__class__(repo.ui, repo.origroot)) |
|
994 | raise hg.RepoError(_('no repo found')) | |
993 | hgwebobj.run(req) |
|
995 | hgwebobj.run(req) | |
994 |
|
996 | |||
995 |
|
997 |
General Comments 0
You need to be logged in to leave comments.
Login now