CodePlex's SvnBridge
Recently I have been working on CodePlex's SvnBridge. This is an ambitious project, attempting to give a Subversion client the impression that it is working on Subversion while the real back end is a Team Foundation Server.
I would have said that this is not possible, if I was asked. But not only this is possible, the CodePlex team actually got that working. A tiny disclaimer here, it is not 100% complete, but it is close enough to that that you can work normally with that without much issues. Some things still do not work, but they are generally uncommon features, and I am working on that.
I have been working with the code base for about a week, and I have a few observations to make.
Tests, tests, tests. The SvnBridge has close to one thousand tests. And each and every last one of them is appreciated. I have to do things in the very guts of the system, and having tests to cover my back is the only thing that actually enabled me to do so.
Forget about the backend, what makes a source control is the protocol and the clients. SvnBridge has actually very little to do with TFS. If you implement ISourceControlProvider, you can use an XML file as the backend. No one will know. That might be a really cool way to plug into a temporal database, by the way.
The reason that I mention this is that lately I have been working on figuring out what to send to the client on an update request. The SVN protocol is very interesting to examine, because it carries a lot of the behaviors that SVN has.
As a simple example, and update request can be "from #123 to latest", "from #123 to #125", "from #123 to #121" and, last but not least, "from #123 to latest and blah.txt from #121 to latest".
This means that from the perspective of the server (SvnBridge), in this case, we need to do some pretty interesting stuff. I am not sure how Subversion handles this, but TFS, at least, has a different model. So when SvnBridge accepts such a request, it needs to figure out what to do with it. That is, given the request from the client, it needs to calculate the diff that will be sent to the client from the version that is currently on the server.
That part is handled here, this is a pretty important piece of code, to say the least. It is also pretty hairy at the moment. There are a lot of edge cases to cover (all of them, I have to mention again, were covered by tests, making it possible to change that safely, pure bliss, compared to the alternative).
Anyway, I just wanted to give you some heads up about that. It has gotten some new features, and I plugged a few bugs. Right now my priority is to fix protocol level bugs, and then some of the higher voted issues, and then put a lot of focus on performance.
Feel free to drop in the discussion board, I read that when the integration tests are running, and it doesn't get enough visitors to make it really interesting :-)
Comments
Great to hear that you're working on this! I imagine there are a lot of interesting problems to solve in translating between protocols and modes of operation.
Actually, there isn't much.
The main issue is that SVN is all about diffs, and TFS is all about state at a point in time.
This is over simplifying a bit, but it is a good description.
Once you get over that, the challenge become taking a state in time and translating that to a diff.
SVN diff's approach is not just for the files, it is for the entire structure. Right now the challenge that I am facing is that you may have multiply source points to a single destination. That turns out to be fairly hard.
Great to hear you're working on this, Oren. I use it for 2 pet projects I host on CodePlex, and have found it absolutely priceless, given that I don't have access to TFS. Thanks for contributing to this open source project.
Thanks for the heads up on this project. Now there is finally a way for out analysts etc. to get to artefacts in TFS. IMHO, this plugs a big hole in TFS.
I'm kind of surprised you started working on this project. Considering that you've been talking lately about "zero friction", I figured that anything that made it difficult to contribute code would simply be tossed aside.
Since your tool of choice is Subversion, and there are many open source hosting providers out there (SourceForge, GoogleCode, etc.) that use Subversion, it would seem that if there was a project that you wanted to contribute to that didn't have native SVN support, that you'd either try to convince them to switch providers, or decide it wasn't worth the hassle.
Lately I've seen many projects start on CodePlex and end up moving their code to GoogleCode simply because they wanted native Subversion support.
So just curious, what made you start using CodePlex and tackle SvnBridge?
My favorite chapter in the book Beautiful Code is about the subversion diff engine. I highly recommend it to anyone interested in how subversion works internally.
I am working on that as in _work_. Not off my own free time.
So, you are one of the svnbridge's people, let me tell you one thing:
THANK YOU!!!
Keep the good work Ayende!
Comment preview