使用hg convert合并2个repos而不是hg pull -f有优势吗? [英] Are there advantages of using hg convert to merge 2 repos instead of hg pull -f?
问题描述
在文档中,他们使用具有以下内容的映射文件:
In the documentation they use a mapfile with these contents:
$ echo include subfoo > /tmp/myfilemap
$ echo rename subfoo . >> /tmp/myfilemap
$ hg convert --filemap /tmp/myfilemap /path/to/repo/foo /tmp/mysubfoo-repo
合并2个repos之类的优点是什么?有正当的理由不这样做吗?
What are the advantages of merging 2 repos like. Is there a valid reason not to do this:
hg pull -f other_repo
hg merge
通过将subfoo重命名为,他们完成了什么工作. ?
What are they accomplishing via the rename of subfoo to . ?
推荐答案
他们的示例(您在问题中发布的subfoo文件映射)用于将现有存储库的子目录转换为具有其所有历史记录的存储库.该子目录下的文件.将subfoo
重命名为.
意味着源存储库中目录subfoo
的所有文件和目录现在都将位于新存储库的根目录下.
Their example (the subfoo filemap you posted in your question) is for converting a subdirectory of an existing repo to a repository of its own, with all the history of the files under that subdirectory. The rename of subfoo
to .
means that all files and directories of the directory subfoo
in the source repo will now be under the root of the new repo.
您可以使用带有rename
的文件映射来执行相反的操作,并使存储库A的根目录的内容现在成为子目录的内容,然后使用pull
将其与存储库B组合:
You could use a filemap with rename
to do the opposite and to make the contents of the root of repo A now the contents of a subdirectory, then combine it with repo B using pull
:
> echo rename . subfoo > /tmp/myfilemap
> hg convert --filemap /tmp/myfilemap /path/to/repoA /path/to/repoA_converted
> hg -R /path/to/repoB pull -f /path/to/repoA_converted
> hg merge
但是, subrepos 可能是一个更好的选择.
However, subrepos might be a better alternative to that.
这篇关于使用hg convert合并2个repos而不是hg pull -f有优势吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!