Query: How to perform a shallow p4 convert

Tom Widmer tom.widmer at googlemail.com
Tue Jul 21 07:41:39 CDT 2009


dhruva wrote:
> Hello,
> 
> 
> 
>> you're doing an hg2hg conversion!), do:
>>
>> hg convert --splicemap mymap.txt [repo from step 5] [repo from step 6]
>>
>> mymap.txt should have a single line:
>>
>> [full sha1 hash of first rev of converted history] [full sha1 hash of 
>> initial import ci rev]
>>
>> (that is specifying that the parent rev of the first rev of the 
>> conversion to be your initial import of root_changeset rev).
>>
>> Hope that helps.
> 
> 
> Thank you, that helped. Once I tried doing an incremental convert of the p4 repository, the imported change did not attach itself to the tip and created 2 heads! I think it is a problem with the converter. On incremental convert, it should use the current tip as the parent of some other logic to figure out the parent if there are multiple heads. I could use the same approach you have described after each incremental import but that is too much of manual work and cannot be automated.
>  For records, git (p4-git) conversions works fine. It automatically continues from where it left off. No need for startrev. The problem with startrev is from the current repo, you will get the last imported change number and not the next change that needs importing. Ideally, the convert should start with startrev+1. Everytime I want to do an incremental convert, I need to locate the change 1 greater than the change at current tip and start.

http://selenic.com/repo/hg-stable/file/41bc92142f06/hgext/convert/p4.py

It looks like incremental import is not implemented (setrevmap is not 
implemented). So enhancing p4.py or automating the above procedure are 
probably your best options. I think you want:

[first increment, import up to x]:
hg convert --rev x p4repo newhgrepo

[later increments, import from x+1 to y]:
hg convert --startrev x+1 --rev y p4repo incrementalhgrepo
cd incrementalhgrepo
hg log -r0 --template "{node}" > ../firstrev
cd ../newhgrepo
hg log -r tip --template "{node}" > ../lastrev
cd ..
echo -n " " | cat firstrev - lastrev > splicemap
hg convert --splicemap splicemap incrementalrepo newhgrepo

[now set x=y]

Or something like that.

Tom



More information about the Mercurial mailing list