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

发布于 2024-09-18 07:43:14 字数 450 浏览 5 评论 0原文

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

我想将这些存储库提供给网络浏览器,以便我在需要时可以直观地浏览。我环顾四周,看到了这个: https://www.mercurial-scm.org/wiki /HgServeNginx

看起来一切都在正确的轨道上,因为无论如何我都会在这个服务器上使用 Nginx。但我很想知道如何正确设置它。为了通过 Web 浏览器在我的服务器上有效地提供多个存储库,我需要做什么?

对此的任何帮助或经验丰富的见解都将非常有助于确保我正确地执行此操作。

非常感谢。

I'm setting up my freelance server which will be using Mercurial for all the version controlling. 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. I've looked around and seen this: 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. 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?

Any help or experienced insight on this would be very helpful to make sure I'm doing this correctly.

Many thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

佞臣 2024-09-25 07:43:14

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

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

然后您可以通过 nginx 将所有请求代理到正在运行的 hg 服务器。这不是一个很好的办法。此方法需要手动编辑 nginx 配置,运行 hgserve 等。但此方法允许您为每个存储库创建单独的身份验证设置。因此,如果您计划与客户共享存储库,您可以轻松管理。

相反,您可以使用由 Mercurial 提供的特殊脚本 - hgwebdir。
详细信息,您可以在此页面上查看:https://www.mercurial-scm。 org/wiki/PublishingRepositories#Publishing_Multiple_Repositories

更新: 我在服务器上有 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;
    }
}

Using that link, you can configure as many locations as you will have repos. In every repo directory, you need to run 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. 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. 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.
Detailed info, you can fine on this page: 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:

#!/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:

[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

Related nginx.conf part is:

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;
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文