tags:

views:

102

answers:

2

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?

+2  A: 

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 convert to create a new mercurial repo from f1, let's call it f5, and then to hg pull -f f5 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.

Ry4an
This all looks like far more work than it's worth. I have a complete history, even if it is in two separate repositories. But I am learning more about Mercurial every day :)Thanks.
nedlud
+1  A: 

Have you tried the Transplant extension? It allows you to pull changes, even if the repository is unrelated.

So what you could do is take f1, do a convert it to your new repo, called HGSVN. This repo will hold you whole svn-created history. If you've done no more modifications in f1, you know that f3 holds all modifications after the copy (f2). Now you can use transplant, to get all the later changes into HGSVN. Yes, the sha1-sums would have been changed, but since HGSVN now contains your entire development history, you can forget about the other repositories.

BTW. I recommend you do a backup clone before doing the actual transplant. This way you can just do it again, if you get the commands wrong. Hope this help.

Kai Inkinen
It's a good idea. But I'm still going to throw my hands up in the air and say it's all more work than it's worth ;)
nedlud