Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Version control 如何在浏览器中正确服务Mercurial存储库?_Version Control_Mercurial_Nginx_Repository_Hgserve - Fatal编程技术网

Version control 如何在浏览器中正确服务Mercurial存储库?

Version control 如何在浏览器中正确服务Mercurial存储库?,version-control,mercurial,nginx,repository,hgserve,Version Control,Mercurial,Nginx,Repository,Hgserve,我正在设置我的自由职业者服务器,它将使用Mercurial进行所有版本控制。每个项目都有自己的文件夹和存储库。然后,我可以从我的家庭计算机、工作计算机或任何其他计算机上复制到该特定文件夹 我希望将这些存储库提供给web浏览器,以便在需要时进行可视化浏览。我环顾四周,看到了这个: 这看起来是正确的,因为我将在这台服务器上使用Nginx。但我很想知道我是如何正确设置的。为了通过web浏览器有效地为服务器上的多个存储库提供服务,我特别需要做什么 在这方面的任何帮助或有经验的见解都将非常有助于确保我正确

我正在设置我的自由职业者服务器,它将使用Mercurial进行所有版本控制。每个项目都有自己的文件夹和存储库。然后,我可以从我的家庭计算机、工作计算机或任何其他计算机上复制到该特定文件夹

我希望将这些存储库提供给web浏览器,以便在需要时进行可视化浏览。我环顾四周,看到了这个:

这看起来是正确的,因为我将在这台服务器上使用Nginx。但我很想知道我是如何正确设置的。为了通过web浏览器有效地为服务器上的多个存储库提供服务,我特别需要做什么

在这方面的任何帮助或有经验的见解都将非常有助于确保我正确地执行此操作


非常感谢。

使用该链接,您可以配置尽可能多的位置。在每个repo目录中,您都需要运行hg serve:

cd repos/repo1;        
nohup hg serve -p 8000 &
cd repos/repo2;
nohup hg serve -p 8001 &
然后,您可以通过nginx将所有请求代理给运行hg服务器的服务器。这不是很好的方式。此方法需要手动编辑nginx配置、运行hg-serve等。但此方法允许您为每个repo创建单独的身份验证设置。所以,如果您计划与客户共享回购协议,您可以轻松地进行管理

相反,您可以使用特殊的脚本,该脚本由mercurial--hgwebdir提供。 详细信息,您可以在此页面上查看:

更新:我在服务器上安装了mercurial 1.6版,对于runnung repo web UI,我们使用以下脚本hgwebdir.py

#!/usr/bin/env python
import sys 
import os
os.environ["HGENCODING"] = "UTF-8"
from mercurial.hgweb.hgwebdir_mod import hgwebdir
from mercurial.hgweb.request import wsgiapplication
from flup.server.fcgi import WSGIServer

def make_web_app():
   return hgwebdir('/home/hg/hgwebdir.conf')

WSGIServer(wsgiapplication(make_web_app),
       umask=0000,
       bindAddress='/home/hg/hg.sock').run()
hgwebdir.conf如下所示:

[web]
allow_push = some_useronly
baseurl = 
push_ssl = false
[collections]
/home/hg/repos = /home/hg/repos
要运行:nohup hgwebdir.py&,您需要flup python模块,所以:easy_install flup

相关nginx.conf部分为:

server {
    listen 80;
    server_name hg.example.com;
    gzip off;
    include fastcgi_params;
    location / {
        client_max_body_size 30m;
        auth_basic  "Restricted Area";
        auth_basic_user_file /home/hg/hg.password;
        fastcgi_pass unix:/home/hg/hg.sock;
    }
}

@zada zorg这看起来复杂多了。鉴于我将使用Nginx(而不是Apache),我是否需要使用类似FastCGI的东西来运行.cgi脚本?我不太清楚如何使用Nginx设置。在链接页面的顶部还显示:“请注意,从Mercurial的1.6版开始,hgwebdir.cgi脚本不再存在,其功能已合并到hgweb.cgi脚本中。如果要发布多个存储库,请按照相应的说明,将hgweb.cgi替换为hgwebdir.cgi。“