splicemap to "inject" files?

Tom Udale tom at ionoptix.com
Fri Aug 19 13:45:28 UTC 2011


Dear Tom,


>> Since in my particular case the subrepos were pretty much read only, I
>> was wondering if it might not be possible to manually inject the correct
>> hgsub and hgsubstate files back into the history with
>>
>> hg convert --splicemap.
 >
> Yes, I think is the answer.
>
> Well, I don't think you should create it at 2001 if that's not where you
> want it.
>
> Ok, convert the repo first of all, with no splicemap, to make
> 'original'. Now, create a clone from changeset 4, 'cloned', add in your
> sub files and commit.
>
> Now you can use a splicemap. Use 'cloned' as the target of the convert
> (even though it already exists - it already has the desired revision 5
> there ready for you!), and use a splicemap referring to 'cloned's rev 5
> as the parent of 'original's rev 5. Then the conversion should run fine,
> taking on original's rev 5-2000 onto your new cloned rev 1-5.

Ok, that worked great for injecting a file (or whatever) into the 
history.  I was able to clone to some arbitrary revision in the past 
(which I did not know about), add arbitrary commits to the clone and 
then tack on the rest of the original history to the end of the clone. 
It looked like this (I am using the notation main:x to indicate the 
nodeid for main repository change set x in these examples):

hg clone -r main:0 main clone
rem add whatever to clone
rem make splice file (child parent): main:1 clone:tip
hg convert --splicemap splice main clone

That worked perfectly.

So now to be a tad more sophisticated.  To do this repeatedly without 
having to re-clone every time, I can just add a --rev on the convert right?

For example, given our 0-5 change set repository, I want to inject 
changes between CS 0-1 _and_ 4-5.

Can I just

rem --- first modify between 0-1 ---
hg clone -r main:0 main clone
rem add whatever to clone
rem make splice file with: main:1 clone:tip
hg convert --splicemap splice --rev main:4 main clone
rem clone should contain up to main:4 now

rem --- now modify between 4-5 ---
rem add whatever else to clone
rem make splice file with: main:5 clone:tip
hg convert --splicemap splice main clone

That should do it right?  I can just go on and on pulling slices from 
main onto clone until I have everything chip-chopped together.

Best regards,

Tom




More information about the Mercurial mailing list