I have a Hg repository with changeset 0 representing just “adding .hgignore”. Starting with changeset 1 I added changesets step by step from a number of Subversion revisions by a script. Then I worked for some time with Hg.
Now I decided that some more Svn revisions will be needed, which are located earlier in history than the beginning revision (changeset 1 in Hg).
Is it possible to insert new changesets between 0 and 1? If yes: How?
You can use a Mercurial to Mercurial conversion for this. You need to enable the convert extension for this. The extension will let you splice history together as part of the conversion. This simply means that you can specify new parents for an existing changeset.
So if you start with
You can first import the needed revisions from SVN:
This will create a second root changeset — you now effectively have two disjoint histories in your repository. I made a single changeset where I added a
bazfile:The final step is to link the histories together: we want 17474bd28fe5 to have 515e1292862b as its first parent. Use
hg log --debugto see the full changeset hashes and make a slice map file withThen run
You will find the modified history in
your-spliced-repo.