##// END OF EJS Templates
adding "prefix" option to "hg serve" (command line and [web] section)...
Michele Cella -
r5835:bd34f0ac default
parent child Browse files
Show More
@@ -2393,7 +2393,7 b' def serve(ui, repo, **opts):'
2393 s.serve_forever()
2393 s.serve_forever()
2394
2394
2395 parentui = ui.parentui or ui
2395 parentui = ui.parentui or ui
2396 optlist = ("name templates style address port ipv6"
2396 optlist = ("name templates style address port prefix ipv6"
2397 " accesslog errorlog webdir_conf certificate")
2397 " accesslog errorlog webdir_conf certificate")
2398 for o in optlist.split():
2398 for o in optlist.split():
2399 if opts[o]:
2399 if opts[o]:
@@ -3024,6 +3024,7 b' table = {'
3024 ('E', 'errorlog', '', _('name of error log file to write to')),
3024 ('E', 'errorlog', '', _('name of error log file to write to')),
3025 ('p', 'port', 0, _('port to use (default: 8000)')),
3025 ('p', 'port', 0, _('port to use (default: 8000)')),
3026 ('a', 'address', '', _('address to use')),
3026 ('a', 'address', '', _('address to use')),
3027 ('', 'prefix', '', _('prefix path to serve from (default: server root)')),
3027 ('n', 'name', '',
3028 ('n', 'name', '',
3028 _('name to show in web pages (default: working dir)')),
3029 _('name to show in web pages (default: working dir)')),
3029 ('', 'webdir-conf', '', _('name of the webdir config file'
3030 ('', 'webdir-conf', '', _('name of the webdir config file'
@@ -76,7 +76,7 b' class _hgwebhandler(object, BaseHTTPServ'
76 self.do_POST()
76 self.do_POST()
77
77
78 def do_hgweb(self):
78 def do_hgweb(self):
79 path_info, query = _splitURI(self.path)
79 path, query = _splitURI(self.path)
80
80
81 env = {}
81 env = {}
82 env['GATEWAY_INTERFACE'] = 'CGI/1.1'
82 env['GATEWAY_INTERFACE'] = 'CGI/1.1'
@@ -84,8 +84,8 b' class _hgwebhandler(object, BaseHTTPServ'
84 env['SERVER_NAME'] = self.server.server_name
84 env['SERVER_NAME'] = self.server.server_name
85 env['SERVER_PORT'] = str(self.server.server_port)
85 env['SERVER_PORT'] = str(self.server.server_port)
86 env['REQUEST_URI'] = self.path
86 env['REQUEST_URI'] = self.path
87 env['SCRIPT_NAME'] = ''
87 env['SCRIPT_NAME'] = self.server.prefix
88 env['PATH_INFO'] = path_info
88 env['PATH_INFO'] = path[len(self.server.prefix):]
89 env['REMOTE_HOST'] = self.client_address[0]
89 env['REMOTE_HOST'] = self.client_address[0]
90 env['REMOTE_ADDR'] = self.client_address[0]
90 env['REMOTE_ADDR'] = self.client_address[0]
91 if query:
91 if query:
@@ -206,6 +206,7 b' def create_server(ui, repo):'
206 myui = repo.ui
206 myui = repo.ui
207 address = myui.config("web", "address", "")
207 address = myui.config("web", "address", "")
208 port = int(myui.config("web", "port", 8000))
208 port = int(myui.config("web", "port", 8000))
209 prefix = myui.config("web", "prefix", "").rstrip("/")
209 use_ipv6 = myui.configbool("web", "ipv6")
210 use_ipv6 = myui.configbool("web", "ipv6")
210 webdir_conf = myui.config("web", "webdir_conf")
211 webdir_conf = myui.config("web", "webdir_conf")
211 ssl_cert = myui.config("web", "certificate")
212 ssl_cert = myui.config("web", "certificate")
@@ -254,6 +255,7 b' def create_server(ui, repo):'
254 addr = socket.gethostname()
255 addr = socket.gethostname()
255
256
256 self.addr, self.port = addr, port
257 self.addr, self.port = addr, port
258 self.prefix = prefix
257
259
258 if ssl_cert:
260 if ssl_cert:
259 try:
261 try:
@@ -129,6 +129,7 b' rawcommit'
129 --noninteractive
129 --noninteractive
130 --pid-file
130 --pid-file
131 --port
131 --port
132 --prefix
132 --profile
133 --profile
133 --quiet
134 --quiet
134 --repository
135 --repository
General Comments 0
You need to be logged in to leave comments. Login now