I’ve been playing around with different versioning systems to find one I’m comfortable with. I started with SVN (lets call this version of the project “f1”), then changed over to GIT. But I didn’t know how to convert the old SVN repo to GIT, so I just copied the folder, deleted the .svn stuff, and turned it into a GIT repo (lets call this copied version “f2”).
Now I’m playing around with Mercurial and was very pleased to find that it has a Tortoise client for Windows. I was also please to find how easy it was to convert the GIT repo into Mercurial, so I preserved the history (I still cloned it first, just in case. So I’m calling this hg version “f3”).
But now what I’m wondering is: what do I do with the old SVN repo that still holds my history from before I played with GIT?
I guess I can convert the old SVN repo to Mercurial, but can I then merge those two histories into the one repository so I have a complete set of histories in one place? In other words, can I prepend f1 to f3?
You can’t prepend f1 to f3 in the literal history/ancestor sense without fundamentally altering f3, because every revision in mercurial is identified by a hashcode, and that hashcode is constructed from (among other things) the content of the revision and the hashes of its parents. So changing the parent of f3’s first node would change all of f3’s hashcodes.
So you can prepend f1 to f3 if you’re willing to regenerate f3 in the process yielding, say f4. Doing so would invalidate all the clones of f3 out there — but if you’re a one person team that might be okay with you.
If you’re not okay with altering every hash in f3 (and I wouldn’t be) another (not so great) option is to use
hg convertto create a new mercurial repo from f1, let’s call it f5, and then tohg pull -ff5 into f3. Since no changeset in f5 would be an ancestor or child of any changeset in f3 — no common lineage — you’d end up with two heads and two streams of changesets. Some folks do that, but honestly I don’t see any real benefit in doing it.Where I you, I’d just convert f1 into f5 (a mercurial repo with all your old history) and then keep it around for reference.