问题
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