Mercurial localhost "site" overview of code. Issues
Mercurial offers the ability to view the code, logs, branches, etc... on a local webserver.
Simply entering the command "hg serve" in the folder of your project, will enable you to view all this on http://127.0.0.1:8000/
I have some issues here.
1) It seems like you can only do this for a single project at a time, since this reserves port 8000. So if I have a number of different projects that I want multiple people to be able to view at all times, what do I do?
2) The "files" overview lists all existing files right after each other. No tree structure or anything, it just lists them in one long line, going to newlines only by the fact th开发者_Go百科at the CSS of the box has a max-width set. Is there a way around this, or am I stuck with it?
hg serve
is meant to allow for example two coworkers to temporarily expose one's repo while the other will pull the changes. It's not made to be a full repo publishing service, it's only a very useful tool to communicate changes in a short time.
If you want to (permanently) expose several repo from your own server, you'll have to do more : https://www.mercurial-scm.org/wiki/PublishingRepositories
You can also use a public hosting service like http://bitbucket.org (that allow for private project too for free, under conditions), Sourceforge.net or http://code.google.com/hosting (that only allow open-source projects).
hg serve
accepts a -p
option that controls the listening port.
hg serve -p 8001
Using the --web-conf
parameter you can use an hgwebdir configuration file which specifies multiple repositories from the one URL.
I've actually found that if you don't want to mess around with setting up hgwebdir on apache, a good solution is to use mercurial-server to serve (push-pull) repositories over ssh (certificates only) and use hg serve
to expose a read-only web view with the graph log, etc. Obviously this assumes that the web view isn't going to have a huge amount of traffic - if you need that, take the time to set up apache with mod_wsgi
.
For example, my personal server (using mercurial-server with a home directory of /home/hg
) has an /etc/init.d/hgserve
which invokes something like:
hg serve --daemon --port 8000 --web-conf /home/hg/hgweb.config --accesslog /var/log/mercurial/access.log --errorlog /var/log/mercurial/error.log
hgweb.config just contains:
[paths] repos = /home/hg/repos/*
This then displays a list of every repository it finds under /home/hg/repos
. If I want to hide any (e.g. the hgadmin
repo that mercurial-server uses) I just add the following to the repo's hgrc
:
[web] hidden = True
As the the files list - you might be able to get somewhere by modifying the templates and pass the --template
parameter to hg serve
. In your mercurial libraries will be the mercurial/templates
directory - this contains all the templates that hg serve
uses - copy it somewhere and then modify. The templates for the various web pages are in the mercurial/templates/paper
directory (and mercurial/templates/static
contains stylesheets and javascript).
Unfortunately the only modification I've made is to add a dotted line linking each node in the graph to its text (which I find makes the graph much more readable) so I don't know if you'll be able to do anything for the file list with just the templates.
精彩评论