Mercurial 本地主机“站点”代码概述。问题
Mercurial 提供了在本地网络服务器上查看代码、日志、分支等的能力。
只需在项目文件夹中输入命令“hgserve”,您就可以在 http://127.0 上查看所有内容.0.1:8000/
我这里有一些问题。
1)似乎一次只能对一个项目执行此操作,因为这保留了端口 8000。因此,如果我有多个不同的项目,我希望多个人能够随时查看,我该怎么办做?
2) “文件”概述依次列出所有现有文件。没有树结构或任何东西,它只是将它们列在一长行中,仅通过盒子的 CSS 设置了最大宽度来换行。有没有办法解决这个问题,还是我坚持下去?
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 that the CSS of the box has a max-width set. Is there a way around this, or am I stuck with it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
hgserve
的目的是允许两个同事暂时公开一个人的存储库,而另一个人则拉取更改。它并不是一个完整的存储库发布服务,它只是一个非常有用的工具,可以在短时间内传达更改。如果您想(永久)从自己的服务器公开多个存储库,则必须执行更多操作: https://www.mercurial-scm.org/wiki/PublishingRepositories
您还可以使用公共托管服务,例如 http ://bitbucket.org(在有条件的情况下也允许免费私人项目)、Sourceforge.net 或 http://code.google.com/hosting(仅允许开源项目)。
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).
hgserve
接受-p
选项控制监听端口。hg serve
accepts a-p
option that controls the listening port.使用
--web-conf
参数,您可以使用 hgwebdir 配置文件,该文件从一个 URL 指定多个存储库。我实际上发现,如果您不想在 apache 上设置 hgwebdir,一个好的解决方案是使用 mercurial-server 通过 ssh(仅限证书)提供(推拉)存储库,并使用
hgserve
公开带有图形日志的只读 Web 视图,显然,这假设 Web 视图不会有大量流量 - 如果您需要,请花时间使用mod_wsgi
设置 apache。例如,我的个人服务器(使用主目录为
/home/hg
的 Mercurial-server)有一个/etc/init.d/hgserve
,它调用如下内容:hgserve --daemon --port 8000 --web-conf /home/hg/hgweb.config --accesslog /var/log/mercurial/access.log --errorlog /var/log/mercurial/error。 log
hgweb.config 仅包含:
然后显示在
/home/hg/repos
下找到的每个存储库的列表。如果我想隐藏任何内容(例如 Mercurial-server 使用的hgadmin
存储库),我只需将以下内容添加到存储库的hgrc
中:作为文件列表 - 您可能会能够通过修改模板并将
--template
参数传递给hgserve
来达到目的。在您的 Mercurial 库中将有mercurial/templates
目录 - 其中包含hgserve
使用的所有模板 - 将其复制到某处然后进行修改。各种网页的模板位于mercurial/templates/paper
目录中(并且mercurial/templates/static
包含样式表和 JavaScript)。不幸的是,我所做的唯一修改是添加一条虚线,将图表中的每个节点链接到其文本(我发现这使得图表更具可读性),所以我不知道您是否能够为此做任何事情仅包含模板的文件列表。
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 withmod_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:
This then displays a list of every repository it finds under
/home/hg/repos
. If I want to hide any (e.g. thehgadmin
repo that mercurial-server uses) I just add the following to the repo'shgrc
:As the the files list - you might be able to get somewhere by modifying the templates and pass the
--template
parameter tohg serve
. In your mercurial libraries will be themercurial/templates
directory - this contains all the templates thathg serve
uses - copy it somewhere and then modify. The templates for the various web pages are in themercurial/templates/paper
directory (andmercurial/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.