Are there advantages of using hg convert to merge 2 repos instead of hg pull -f?

我怕爱的太早我们不能终老 提交于 2019-12-14 01:15:57

问题


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

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

What are they accomplishing via the rename of subfoo to . ?


回答1:


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.

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

However, subrepos might be a better alternative to that.



来源:https://stackoverflow.com/questions/7179887/are-there-advantages-of-using-hg-convert-to-merge-2-repos-instead-of-hg-pull-f

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!