是否有任何支持部分结账/克隆的分布式版本控制系统? [英] Is there any distributed revision control system that supports partial checkout/clone?
问题描述
在分布式rcs中,文件的历史记录(或一大块内容)是一个有向无环图,那么为什么你不能只克隆这个单一的DAG,而不是存储库中所有图的集合呢?可能我错过了一些东西,但是下面的用例很难做到:
如果我重复使用来自多个项目的其他人的部分代码,我无法保留其完整的历史记录。至少在git中我可以想到一个(相当复杂的)解决方法:
$ b
- 克隆一个完整的仓库
- 删除所有我不感兴趣的内容
- 重写历史记录以删除不在主内容中的所有内容
- 将剩余的存储库合并到现有的存储库
我不知道Mercurial或Bazaar是否也可以这样做,但至少它不容易。那么是否有任何分布式的rcs支持部分结账/克隆设计?它应该支持一个简单的命令,从一个存储库获取具有其历史记录的单个文件并将其合并到另一个文件中。这样您就不需要考虑如何将内容构建到存储库和子模块中,但是您可以根据需要愉快地拆分和合并存储库(极限应该是每个单个文件的一个存储库)。
<从2.0版开始,不可能制作所谓的narrow clone与Mercurial,也就是说,您只能检索特定子目录的数据的克隆。我们称之为浅层克隆,当您只检索部分历史记录时,比如说最近的100个修订版本。
顺便说一下,您当然可以拆分现有的Mercurial存储库分成小块,其中每个较小的存储库只有原始存储库的特定子目录的历史记录。 转换扩展是此工具。虽然每个较小的存储库都与较大的存储库无关,但棘手的部分是无缝分离,以便更改集保留其身份。
As far as I know all distributed revision control systems require you to clone the whole repository. For this reason is it not wise to put huge amounts of content into one single repository (thanks for this answer). I know that this a not a bug but a feature, but I wonder whether this is a requirement for all distributed revision control systems.
In distributed rcs the history of a file (or a chunk of content) is a directed acyclic graph, so why can't you just clone this single DAG instead of the set of all graphs in the repository? Maybe I miss something but the following use-cases are hard to do:
- clone only a part of a repository
- merge two repositories (preserving their histories!)
- copy some files with their history from one repository to another
If I reuse parts of other people's code from multiple projects I cannot preserve their full history. At least in git I can think of a (rather complex) workaround:
- clone a full repository
- delete all content that I am not interested in
- rewrite the history to delete everything that is not in the master
- merge the remaining repository into an existing repository
I don't know if this is also possible with Mercurial or Bazaar but at least it is not easy at all. So is there any distributed rcs that supports partial checkout/clone by design? It should support one simple command to get a single file with its history from one repository and merge it into another. This way you would not need to think about how to structure your content into repositories and submodules but you could happily split and merge repositories as needed (the extreme would be one repository for each single file).
As of version 2.0, it is not possible to make a so-called "narrow clone" with Mercurial, that is, a clone where you only retrieve data for a specific sub-directory. We call it a "shallow clone" when you only retrieve part of the history, say, the last 100 revisions.
As you say, there is nothing in the common DAG-based history model that excludes this feature and we have been working on it. Peter Arrenbrecht, a Mercurial contributor, has implemented two different approaches for narrow clones, but neither approach has been merged yet.
Btw, you can of course split an existing Mercurial repository into pieces where each smaller repository only has the history for a specific sub-directory of the original repository. The convert extension is the tool for this. Each of the smaller repositories will be unrelated to the bigger repository, though — the tricky part is to make the splitting seamless so that the changesets keep their identities.
这篇关于是否有任何支持部分结账/克隆的分布式版本控制系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!