Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加Mercurial代码库相关的功能函数 #139

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

linuxbckp
Copy link

1.增加同步Mercurial代码库的先决条件函数:init_git_remote_hg(),用于初始化依赖脚本、更新git设置等。此函数只需调用一次即可,无需每次同步Mercurial代码库都调用。
2.增加repo_init()函数的Mercurial适用版本:repo_init_hg()
3.增加update_repo_git()函数的Mercurial适用版本:update_repo_git_hg()
4.由于Mercurial支持MultipleHeads,所以出于防止歧义的考虑,我没法实现checkout_repo()函数的Mercurial适用版本。MultipleHeads的链接详见:https://www.mercurial-scm.org/wiki/MultipleHeads

1.增加同步Mercurial代码库的先决条件函数:init_git_remote_hg(),用于初始化依赖脚本、更新git设置等。此函数只需调用一次即可,无需每次同步Mercurial代码库都调用。
2.增加repo_init()函数的Mercurial适用版本:repo_init_hg()
3.增加update_repo_git()函数的Mercurial适用版本:update_repo_git_hg()
4.由于Mercurial支持MultipleHeads,所以出于防止歧义的考虑,我没法实现checkout_repo()函数的Mercurial适用版本。MultipleHeads的链接详见:https://www.mercurial-scm.org/wiki/MultipleHeads
@taoky
Copy link
Contributor

taoky commented May 10, 2022

镜像站直接以静态文件 serve hg clone 出的 .hg 会有什么问题呢?

@linuxbckp
Copy link
Author

镜像站直接以静态文件 serve hg clone 出的 .hg 会有什么问题呢?

直接hg clone的效果,类似于git clone不加--mirror一样

@linuxbckp
Copy link
Author

linuxbckp commented May 10, 2022

镜像站直接以静态文件 serve hg clone 出的 .hg 会有什么问题呢?

另外,如果每次都更换.hg文件然后hg clone,那我没见过这么搞的。对于目前的Git镜像源,难道服务器也是每次都要把.git文件换了吗?显然不是这样

@taoky
Copy link
Contributor

taoky commented May 10, 2022

镜像站直接以静态文件 serve hg clone 出的 .hg 会有什么问题呢?

另外,如果每次都更换.hg文件然后hg clone,那我没见过这么搞的。对于目前的Git镜像源,难道服务器也是每次都要把.git文件换了吗?显然不是这样

当然不可能,只在第一次同步的时候 hg clone,之后都 hg pull。但是引入一个奇怪的脚本,然后用 git 去同步 hg 仓库感觉太奇怪了,难道 hg 没有原生的等效于 git clone --bare(或者 git clone --mirror)的实现?我之前测试过在一台机器上 hg clone,然后另一台机器 HTTP 从该机 hg clone 也没有问题。

而且在服务端(用 git smart protocol)服务 git 仓库是需要启动额外的程序的,如果能直接以静态文件服务,可以节省相关的开销。

@linuxbckp
Copy link
Author

镜像站直接以静态文件 serve hg clone 出的 .hg 会有什么问题呢?

另外,如果每次都更换.hg文件然后hg clone,那我没见过这么搞的。对于目前的Git镜像源,难道服务器也是每次都要把.git文件换了吗?显然不是这样

当然不可能,只在第一次同步的时候 hg clone,之后都 hg pull。但是引入一个奇怪的脚本,然后用 git 去同步 hg 仓库感觉太奇怪了,难道 hg 没有原生的等效于 git clone --bare(或者 git clone --mirror)的实现?我之前测试过在一台机器上 hg clone,然后另一台机器 HTTP 从该机 hg clone 也没有问题。

而且在服务端(用 git smart protocol)服务 git 仓库是需要启动额外的程序的,如果能直接以静态文件服务,可以节省相关的开销。

很遗憾。hg官方确实没有这种实现
另外,网上有人曝出过hg clone和源代码库产生冲突的问题。宁可信其有,不可信其无。
所以还是谨慎为妙,虽然用了git多点开销,但换来的是已经被验证过的解决方案,这肯定是一个好的选择。

# ---------------------------------------
function init_git_remote_hg() {
mkdir /usr/bin
curl -o /usr/bin/git-remote-hg https://raw.githubusercontent.com/fingolfin/git-remote-hg/master/git-remote-hg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我们不在脚本中下载可执行文件,我们会在 Dockerfile 中使用发行版的软件包。我们建议使用已经打包好的工具,例如直接使用 hg。

RUN apt-get update && \
apt-get install -y wget curl rsync lftp git jq python3-dev python3-pip yum-utils createrepo aria2 ack composer php-curl php-zip libnss-unknown

@ZenithalHourlyRate
Copy link
Contributor

ZenithalHourlyRate commented May 11, 2022

所以还是谨慎为妙,虽然用了git多点开销,但换来的是已经被验证过的解决方案,这肯定是一个好的选择。

以 git 方式服务 hg 软件源并不是「镜像」,用户并不能获得和上游一致的工具体验,我们也不知道转换成 git 后用户是否能正常利用该镜像。

建议直接使用 hg 同步相关文件,并将其放在单独的脚本中。

另外可以参考 ustclug/mirrorrequest#251 (comment)

@linuxbckp
Copy link
Author

linuxbckp commented May 11, 2022 via email

@linuxbckp
Copy link
Author

linuxbckp commented May 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants