I'm wondering if I can copy one file and its history from one repository to another, without having to import the whole other repository.
2 Answers
You can use the ConvertExtension to export just that one file from the first repository into a new temporary repository, then use hg pull -f to import the new repository into the target repository.
Create a filemap for the ConvertExtension with the single line:
include path/to/file Then use:
hg convert path/to/original path/to/temporary --filemap filemap to create the temporary repository. Next, in the target repository, do:
hg pull -f path/to/temporary to pull in that file with its history. This will create a new head, so use hg merge to merge it with the head in your target repository.
3 Comments
o0'.
I don't get it: I've made a lot of tries, and almost every time Iget a repository with just two commits (but with the correct files). It worked just ONCE and I don't have the slightest idea on what I did different :|
o0'.
ffs I got it: it doesn't handle file renames! You have to explicitly "include" all the previous names of the files too (and I don't know if he will remember they were renames instead of new files)
iteal
Hi! I follow this method but I can't push the result, it says " push create new remote head on branch [an old branch that is closed]" What can I do?