Query: How to perform a shallow p4 convert

Tom Widmer tom.widmer at googlemail.com
Mon Jul 20 10:22:28 CDT 2009


dhruva wrote:
> Hello,
> 
>  I need to perform a shallow convert of a p4 repository with a large history. I do the following...
> 
> 1. Create a p4 client
> 2. p4 sync -f @root_changeset
> 3. hg init
> 4. hg addremove .
> 5. hg ci -m"Initial import from p4: root_changeset
> 6. hg convert with startrev 1 greater than the 'root_changeset'
> 
> The above results in 2 heads. The revision 0 (which I got by addremove) and 1 have -1 as parent. Is there any known way to accomplish this?

The --splicemap option to hg convert should let you do what you want. Do 
the checkin into one hg repo, and the convert into hg another (using 
whatever conversion tool you are using, hg convert or otherwise). Then, 
with the ci repo as the dest and the convert repo as the source (so 
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.

Tom



More information about the Mercurial mailing list