IronRuby Dev Notes

« Back to blog

Git – TFS Integration - Implementation

So, I want to start this with another apology. I didn’t mean to start this series then drop off the face of the earth, and I didn’t mean to state that I would finish this series, and then disappear again.

OK, since that’s out of the way, lets get to the real reason you’re here:

So if you read the table of contents, you know that the 3rd article in this series was supposed to be Decision. Well, I told you what the decision was last week, so I decided to skip that article.

Instead, these last few articles will go into detail about how we have the wrapped TFS repository implemented. It’s fairly simple to be honest, but I’d like to delve in. Today we’ll talk about how it’s setup, and soon I’ll share a PowerShell V2 module that implements this setup.

The basic manual setup is as follows. Map a TFS workspace to the structure you want the Git repository to be in. I highly recommend using making this opt-in. The folder’s that you want should be active, and in the cases where you only want a part of a folder, activate only those parts of the file that you want. Avoid cloaking folders since that usually means you are opting for the entire folder and then opting-out of folders that you don’t want. The danger here is that if someone adds a folder that shouldn’t go out (for example, maybe it contains your signing key), opting in means that folder is left alone, and won’t go out. Opting out means that the new folder will suddenly appear in your Git repo.

Once you have your workspace setup you need to go one folder beneath your mapping. So for IronRuby, the mapping is all underneath Merlin and NDP. Merlin holds the languages, non-2010 DLR, and tests, NDP holds the parts of the DLR that are going into VS2010. On my primary computer, the path to those folders is C:\vsl\rubysync\{Merlin,NDP}. Therefore, I initialized the Git repo in C:\vsl\rubysync. If you already have a Git repository, then you need to clone that Git repo somewhere else on your computer (in my script, it gets cloned in $env:TEMP). After you clone your repo, copy the .git folder into the proper root folder (C:\vsl\rubsync in IronRuby’s case). Finally, you need to synchronize your repositories. Do a tf get /overwrite to get the TFS side up to date, and then, from the root of the repo (where you copied the .git folder) do a git add . followed by a git commit -a -m ‘your message here’. This makes sure that all adds and deletes are automatically picked up. You can feel free to do it manually, but in the current implementation, that isn't worth it for IronRuby. Follow all of this with a git push, and you should be good to go (you may need to setup origin if you initialized a new repo).

So there you go, the basic setup. I highly recommend forking the remote repo for your personal work so that only the Git-TFS bridge repo is pushing to that repo. To update the git repo, just repeat the git add ., git commit -a –m ‘message’, git push series of commands. The reverse is a little more complex, and I’ll talk about that next time, hopefully with some scripts to share.

 
To leave a comment on this posterous, please login by clicking one of the following.
Posterous-login     twitter