Is it safe to use "hg serve"?

Harvey Chapman hchapman-hg at 3gfp.com
Tue Jun 1 14:55:01 UTC 2010


On Jun 1, 2010, at 8:49 AM, Didly Bom wrote:

> Dave, it is actually possible to serve multiple repositories via hg serve. You just need to use the "--webdir-conf" command line parameter, and supply it with a hgwebdir config file (i.e. a file which specifies which repositories should be served by the hg web server).

Seconded. I have a local hg server on my laptop running this way. It allows me to add/remove projects by simply placing them in a folder. I limit access to the server by only allowing local connections. I also keep hg extension clones in ~/.hgrc.d and then create symlinks to those in the server directory. The one additional thing you'll want to do is to add a [web] section to .hg/hgrc in each project like the following so you'll have nice names and descriptions to look at. 

[web]
contact = Harvey Chapman <hchapman at ...>
description = NTLDR Replacement
name = psldr

I use the following setup. I found all of this information via the wiki and the man pages, but not all in one place. The webserver is usually very slow to start and then also later when it needs to be swapped back into memory. It's very quick after that. I also create a local hostname alias named hgweb to make access easier as I do most of my work in NATed VMware machines.

http://hgweb:8000/project

-------------
/etc/hosts
-------------
# This is the local NAT "router" address for my installation of VMware.
172.16.112.1	hgweb

-------------------------------------------------
/Users/hchapman/work/hg/serve.sh 
-------------------------------------------------
#!/bin/bash

MYPATH=/Users/hchapman
DAEMON=-d
#DAEMON=
hg serve $DAEMON --webdir-conf=$MYPATH/.hgrc

--------------------
Add to ~/.hgrc
--------------------
[collections]
/Users/hchapman/work/hg/ = /Users/hchapman/work/hg/

[web]
# If not specified already...
contact = Harvey Chapman <hchapman at .....>

# Logs
accesslog = /Users/hchapman/work/hg/access.log
errorlog = /Users/hchapman/work/hg/error.log

# Allow archive downloads
allow_archive = bz2 gz zip

# Turn off all security, but only listen on a local interface.
push_ssl = false
allow_push = *
address = 172.16.112.1

# Only show top-level repositories
descend = false

#
# Styles
#
# Better than paper.
# More options than coal, but coal is easier on the eyes.
#style = gitweb

# Menus on the right. Looks nice.
# Less shortcuts than git, but it just means everything is two clicks away
# instead of one.
style = coal

#style = paper

# Just paper with less
#style = spartan

#style = monoblue




More information about the Mercurial mailing list