水星稀疏结帐 [英] Mercurial sparse checkout

查看:102
本文介绍了水星稀疏结帐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这段 F8会议视频(从8:40开始)中,他们谈到了在Facebook上使用Mercurial和单个存储库的优势.

In this F8 conference video(starting 8:40) from 2015 they speak about the advantages of using Mercurial and a single repository across facebook.

这在实践中如何运作?使用Mercurial,我可以签出子目录(位于SVN中)吗?如果是这样,怎么办?为此,我是否需要 facebook-mercurial-extension

How does this work in practice? Using Mercurial, can i checkout a subdirectory (live in SVN)? If so, how? Do i need a facebook-mercurial-extension for this

PS:我只找到了之类的答案,或者从2010年开始在中,我不确定答案是否仍然如此运用FB付出的所有努力.

P.S.: I only found answers like this or this from 2010 on SO where i am not sure if the answers still apply with all the efforts FB put into it.

推荐答案

从您的问题尚不清楚,您是在寻找工作流程(monorepo还是多仓库讨论),还是在寻求性能和扩展能力,以达到巨大代码库.

From your question it is not clear if you are looking for a workflow (the monorepo vs multiple repos debate) or for performance and scaling for a huge code base.

对于工作流程,我建议使用Google搜索monorepo.它有其优点和缺点,您需要了解您的情况和当前的工作流程才能做出决定.有关性能和扩展性,请继续阅读.

For the workflow, I suggest googling for monorepo. It has its pros and cons, you need to understand your situation and current workflow to decide. For the performance and scaling, keep reading.

remotefilelog的思想不是签出子目录(如您所述),而是签出所有内容.为了有效地做到这一点,您需要Facebook积极开发的两个扩展程序:

The idea of remotefilelog is not to checkout a subdirectory (as you mention), the idea is to checkout everything. In order to do that in an efficient way, you need two extensions actively developed by Facebook:

  • 远程文件日志.这使您在概念上类似于浅表克隆.这样可以减少hg clonehg pull的时间.
  • fsmonitor (以前称为hgwatchman,现在已成为水银核心的一部分).这大大减少了诸如hg status之类的本地操作的时间.请注意,fsmonitor独立于remotefilelog.您可以开始尝试此操作,因为它不需要在服务器端进行任何设置.
  • remotefilelog. This gives you something conceptually similar to a shallow clone. This reduces hg clone and hg pull time.
  • fsmonitor (previously called hgwatchman, it is now part of mercurial core). This dramatically reduces time of local operations such as hg status. Note that fsmonitor is independent from remotefilelog. You can start experimenting with this, since it doesn't require any setup on the server side.

通过最近的尝试(我强烈建议),您可以使用 CommandServer + CHg .

With a recent mercurial (which I strongly suggest) you can shave off the additional startup time of the Python interpreter using CommandServer + CHg.

一些附加说明:

  • 我进行了广泛的测试fsmonitor.它非常有效,在大型存储库中,hg status的时间从10秒减少到不到1秒(这1秒的大部分时间是Python启动时间,请参见上面的CHg).如果您的存储库确实很大,则可能需要微调一些inotify内核参数(或MacOSX上的等效参数). fsmonitor文档包含您需要的所有信息.
  • 我没有测试remotefilelog,尽管我阅读了有关它的所有内容,但我确信它可以正常工作.根据开发的完成方式(每个人是否始终具有Internet连接,组织是否拥有自己的主存储库),可能会有一个警告:它将分散的hg部分转换为像svn这样的集中式VCS:某些操作通常可以脱机完成的操作(例如:hg log和过去更改集的第一个hg update)现在将需要连接到主存储库.
  • 在考虑remotefilelog之前,我在大型仓库中广泛使用了largefiles扩展名.它具有与remotefilelog相同的缺点,并且对于想要使用hg只是为了使事情完成而又不花时间了解其工作原理的用户来说,有些混乱的情况.如果我要管理另一个庞大的仓库,我会使用remotefilelog而不是largefiles,尽管它们的用例并不完全相同.
  • Mercurial还支持subrepositories( doc1 doc2 ).问题在于,它会根据您在源代码树中的位置来更改hg的行为.再次,如果开发人员不关心真正了解hg的工作原理,那就太令人困惑了.
  • I tested extensively fsmonitor. It works very well, on huge repos the time of hg status is reduced from 10 secs to less than 1 sec (and the majority of this 1 sec is Python startup time, see above for CHg). If your repository is really huge, you might need to fine tune some inotify kernel parameters (or the equivalent on MacOSX). The fsmonitor documentation has all the information you need.
  • I didn't test remotefilelog, although I read everything I found about it and I am sure it works. Depending on how development is done (everybody has always Internet connectivity or not, the organization has its own master repo or not) there can be a caveat: it partially transforms the decentralized hg into a centralized VCS like svn: some operations that normally can be done offline (for example: hg log and the first hg update to a changeset in the past) will now require connectivity to the master repository.
  • Before considering remotefilelog, I used extensively the largefiles extension on a huge repo. It has the same drawbacks than remotefilelog and some confusing corner cases for users that want to use hg just to get things done without taking the time to understand how it works. If I were to manage another huge repo, I would use remotefilelog instead than largefiles, although their use case is not really the same.
  • Mercurial has also support for subrepositories (doc1, doc2). The problem is that it changes the behavior of hg depending on where you are in the source tree. Again, if the developers don't care about really understanding how hg works, it will be just too confusing.

其他信息:

  • Facebook Engineering blog post
  • scaling mercurial wiki, although not completely up to date
  • just by googling mercurial facebook.

这篇关于水星稀疏结帐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆