mercurial - 我可以克隆 Mercurial 存储库的一部分吗?

标签 mercurial dvcs

是否可以克隆 Mercurial 存储库的一部分?假设存储库非常大,或者包含多个项目或多个分支。我可以只克隆存储库的一部分吗?

例如。在 Subversion 中,你可能有 trunkbranches .如果我只想得到主干(或分支之一),我可以请求 [project]/trunk .如果我克隆 hg repo,我将获得主干和所有分支。这可能是很多我不想要的信息。我可以避免得到这个吗?

或者,如果我想在一个 hg repo 中有多个项目,我应该怎么做? IE。这样我就可以只得到其中一个项目而忽略其他项目。

最佳答案

是的你可以。我相信你已经继续前进了,但为了那些稍后会在这里闲逛的人,我遵循了 ConvertExtension 上的文档。 ,并编写了一个简单的批处理脚本:

@echo off
echo Converting %1
REM Create the file map
echo include %1 > ~myfilemap               
echo rename %1 . >> ~myfilemap 
REM Run the convert process
hg convert --filemap ~myfilemap .\ ..\%1   
REM Delete the file map
del ~myfilemap                             
cd ..\%1
REM update the new repo--to create the files
hg update                                  

将其命名为 split.cmd , 并将其放在要拆分的 repo 的目录中。比如说你有 C:\repos\ReallyBigProject ,子文件夹是 C:\repos\ReallyBigProject\small-project .在命令提示符下,运行:
cd\repos\ReallyBigProject
split.cmd small-project

这将创建 C:\repos\small-project有一部分来自较大项目的相关修订历史。
convert默认情况下不启用。您需要确保 .hg\hgrc 中存在以下几行文件(在我的示例中为 c:\repos\ReallyBigProject\.hg\hgrc):
[extensions]
hgext.convert=

关于mercurial - 我可以克隆 Mercurial 存储库的一部分吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1745000/

相关文章:

git - 在 VCS 中使 shell 提示符显示当前头部

version-control - 分布式版本控制系统会促进不良的备份习惯吗?

git - 我可以从另一个分支添加对暂存区的更改吗?

python - hg 转换,Subversion python 绑定(bind)错误

mercurial - 如何移动标签?

Mercurial如何为repo中的一个文件创建补丁

eclipse - Lotus Domino Designer 中的源代码控制

mercurial - .hgsub 中的绝对路径有什么问题?

git - DVC 实验管理工作流程

Git 删除目录