是否有任何支持部分签出/克隆的分布式修订控制系统? [英] Is there any distributed revision control system that supports partial checkout/clone?

查看:20
本文介绍了是否有任何支持部分签出/克隆的分布式修订控制系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,所有分布式版本控制系统都要求您克隆整个存储库.出于这个原因,将大量内容放入一个存储库是不明智的(感谢 这个答案).我知道这不是错误而是功能,但我想知道这是否是所有分布式修订控制系统的要求.

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.

在分布式 rcs 中,文件(或内容块)的历史记录是一个有向无环图,那么为什么不能只克隆这个 DAG 而不是存储库中所有图的集合?也许我错过了一些东西,但以下用例很难做到:

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:

  • 仅克隆存储库的一部分
  • 合并两个存储库(保留它们的历史!)
  • 将一些文件及其历史记录从一个存储库复制到另一个存储库

如果我从多个项目中重用其他人的部分代码,我将无法保留他们的完整历史记录.至少在 git 中我能想到一个(相当复杂的)解决方法:

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:

  1. 克隆一个完整的仓库
  2. 删除所有我不感兴趣的内容
  3. 重写历史以删除master中没有的所有内容
  4. 将剩余的存储库合并到现有的存储库中

我不知道这是否也适用于 Mercurial 或 Bazaar,但至少它一点也不容易.那么是否有任何分布式 rcs 设计支持部分结帐/克隆?它应该支持一个简单的命令来从一个存储库中获取单个文件及其历史记录并将其合并到另一个存储库中.这样您就无需考虑如何将您的内容组织成存储库和子模块,但您可以根据需要愉快地拆分和合并存储库(极端情况是每个文件一个存储库).

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).

推荐答案

从 2.0 版本开始,不可能制作所谓的 "narrow clone" 与 Mercurial,即您只检索特定子目录数据的克隆.当您仅检索部分历史记录(例如最近 100 次修订)时,我们将其称为浅层克隆".

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.

如您所说,常见的基于 DAG 的历史模型中没有任何内容排除此功能,我们一直在努力.Mercurial 的贡献者 Peter Arrenbrecht 为窄克隆实施了两种不同的方法,但两种方法都尚未合并.

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.

顺便说一句,您当然可以将现有的 Mercurial 存储库拆分为多个部分,其中每个较小的存储库仅具有原始存储库的特定子目录的历史记录.convert extension 就是这个工具.但是,每个较小的存储库都将与较大的存储库无关 - 棘手的部分是使拆分无缝,以便变更集保持其身份.

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屋!

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