Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb.py @ 603:bc5d058e65e9
[PATCH] Get "hg serve" to print the URL being served
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[PATCH] Get "hg serve" to print the URL being served
From: Bryan O'Sullivan <bos@serpentine.com>
If invoked with verbosity, print the URL at which we are serving.
Useful if you bind to any port with "-p 0", and need to know what port
the server is listening on.
manifest hash: d317225606fbd2ec5819e1f266575b0485dfba79
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCyL9hywK+sNU5EO8RAjFQAJoDBRl5VoGIklxA1PdFGCt8Jb3iMQCeILeD
XAwnnSCy/IQ/MDfYf6z7oWI=
=FNVC
-----END PGP SIGNATURE-----
author | mpm@selenic.com |
---|---|
date | Sun, 03 Jul 2005 20:47:29 -0800 |
parents | 8865eb8ade99 |
children | 8e82fd763be2 |
comparison
equal
deleted
inserted
replaced
602:56d81b303656 | 603:bc5d058e65e9 |
---|---|
692 sys.stdout.write(z.flush()) | 692 sys.stdout.write(z.flush()) |
693 | 693 |
694 else: | 694 else: |
695 write(self.t("error")) | 695 write(self.t("error")) |
696 | 696 |
697 def server(path, name, templates, address, port): | 697 def create_server(path, name, templates, address, port): |
698 | 698 |
699 import BaseHTTPServer | 699 import BaseHTTPServer |
700 import sys, os | 700 import sys, os |
701 | 701 |
702 class hgwebhandler(BaseHTTPServer.BaseHTTPRequestHandler): | 702 class hgwebhandler(BaseHTTPServer.BaseHTTPRequestHandler): |
757 hg.run() | 757 hg.run() |
758 finally: | 758 finally: |
759 sys.argv, sys.stdin, sys.stdout, sys.stderr = save | 759 sys.argv, sys.stdin, sys.stdout, sys.stderr = save |
760 | 760 |
761 hg = hgweb(path, name, templates) | 761 hg = hgweb(path, name, templates) |
762 httpd = BaseHTTPServer.HTTPServer((address, port), hgwebhandler) | 762 return BaseHTTPServer.HTTPServer((address, port), hgwebhandler) |
763 | |
764 def server(path, name, templates, address, port): | |
765 httpd = create_server(path, name, templates, address, port) | |
763 httpd.serve_forever() | 766 httpd.serve_forever() |