简体   繁体   English

如何在浏览器中正确提供Mercurial存储库?

[英]How to serve Mercurial repositories in the browser correctly?

I'm setting up my freelance server which will be using Mercurial for all the version controlling. 我正在设置我的自由服务器,它将对所有版本控制使用Mercurial。 Each project will have it's own folder, with it's own repository. 每个项目都有自己的文件夹和自己的存储库。 Which I can then clone from my home computer, work computer or any other computer by going to that particular folder. 然后,通过转到该特定文件夹,可以从我的家用计算机,办公计算机或任何其他计算机中克隆该计算机。

I'm wanting to serve these repositories up into a web browser for me to browse visually when I need to. 我想将这些存储库提供到Web浏览器中,以便在需要时进行可视化浏览。 I've looked around and seen this: https://www.mercurial-scm.org/wiki/HgServeNginx 我环顾四周,看到了这个: https : //www.mercurial-scm.org/wiki/HgServeNginx

That looks like it's along the right tracks, as I will be using Nginx on this server anyhow. 看起来这是正确的,因为无论如何我将在此服务器上使用Nginx。 But I'm curious to know how I would correctly set this up. 但是我很好奇我将如何正确设置它。 What do I need to do in particular to efficiently serve up multiple repositories on my server through the web browser? 为了通过Web浏览器在服务器上有效地提供多个存储库,我需要做些什么?

Any help or experienced insight on this would be very helpful to make sure I'm doing this correctly. 对此的任何帮助或经验丰富的见解对于确保我正确执行此操作都将非常有帮助。

Many thanks. 非常感谢。

Using that link, you can configure as many locations as you will have repos. 使用该链接,您可以配置将具有存储库的位置。 In every repo directory, you need to run hg serve: 在每个repo目录中,您需要运行hg serve:

cd repos/repo1;        
nohup hg serve -p 8000 &
cd repos/repo2;
nohup hg serve -p 8001 &

Then you can just proxy all request via nginx to that running hg servers. 然后,您可以通过nginx将所有请求代理到正在运行的hg服务器。 This is not very good way. 这不是很好的方法。 This method need manually edit nginx config, run hg serve etc. But this method allow to you create separate auth settings for each repo. 此方法需要手动编辑nginx配置,运行hg serve等。但是此方法允许您为每个存储库创建单独的身份验证设置。 So if you plan to share repo with customer, you can easily manage this. 因此,如果您打算与客户共享回购协议,则可以轻松进行管理。

Instead, you can use special script, which is contributed with mercurial -- hgwebdir. 相反,您可以使用特殊的脚本,该脚本是由mercurial提供的-hgwebdir。 Detailed info, you can fine on this page: https://www.mercurial-scm.org/wiki/PublishingRepositories#Publishing_Multiple_Repositories 详细信息,您可以在此页面上罚款: https : //www.mercurial-scm.org/wiki/PublishingRepositories#Publishing_Multiple_Repositories

UPDATE: I have mercurial version 1.6 on server, and for runnung repo web UI we use this script hgwebdir.py : 更新:我的服务器上有Mercurial版本1.6,对于运行库回购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 is looks like this: hgwebdir.conf看起来像这样:

[web]
allow_push = some_useronly
baseurl = 
push_ssl = false
[collections]
/home/hg/repos = /home/hg/repos

To run: nohup hgwebdir.py &, you need flup python module, so: easy_install flup 要运行:nohup hgwebdir.py&,您需要flup python模块,因此:easy_install flup

Related nginx.conf part is: 相关的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;
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 克隆到远端库中 - cloning into remote repositories in mercurial 如何将一组mercurial存储库转换为git存储库? - How do I convert a set of mercurial repositories into a git repository? 如何为Mercurial最佳地配置中央存储库/多个中央存储库? - How to best configure a central repository/multiple central repositories for Mercurial? Mercurial-如何获取两个存储库之间不同的文件列表 - Mercurial - How to get a list of files that are different between two repositories 人们如何管理存储在多个(Mercurial)存储库中的公共库文件的更改? - How do people manage changes to common library files stored across mutiple (Mercurial) repositories? 如何使用Mercurial正确更新Live Server? - How Do I Update a Live Server Correctly Using Mercurial? 使用Mercurial将依赖项作为嵌套存储库进行管理 - Using Mercurial to manage dependencies as nested repositories 来自外部存储库的Mercurial“供应商分支”? - Mercurial “vendor branches” from external repositories? Mercurial + hgsubversion + svn:2个存储库的故事......(或者,替换变更集?) - Mercurial + hgsubversion + svn: A tale of 2 repositories… (or, Replace changesets?) 恢复单用户单机Mercurial存储库 - Recovering Single User Single Machine Mercurial repositories
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM