1

I'm currently helping to maintain a project for a client remotely. I'm the only developer ergo some of my unorthodox approaches/thinking.

the problem

The client is using Visual Studio 2010 + Team Foundation Server for their source control. I am working on a Mac over VPN and have tried several approaches to make committing to their TFS workable. I've tried TFS plugin for Eclipse with no luck (VPN really hoses the connection to TFS). Currently I am having to do a full "checkout for edit" through a virtual machine to the TFS, then transferring the project over the VPN to overwrite those files. Not a sustainable solution to say the least.

the solution?

I'm wondering if there is a way to:

  • get a list of changed files from GIT (I think this is the solution (How to list all the files in a commit?)
  • then use that list as a means to go in and fetch those file, maintaining their folder structure
  • from there I can do my dump over VPN into the VM that has the project mapped in TFS.

Or if there is something I've overlooked or hadn't thought of, please do recommend them, I'm all ears.

Community
  • 1
  • 1
jusopi
  • 6,791
  • 2
  • 33
  • 44

1 Answers1

1

First, I'm assuming you are running the VM on or near the TFS server, not on your Mac. If not, you can just share a directory using VMware/VirtualBox and edit away on your Mac...

It sounds like you could achieve what you want with plain old Git. If you:

  1. Create a bare repository on the VM (git init --bare)
  2. Add a post-receive hook to copy the files from the master branch (for example) into the TFS directory, overwriting merrily (http://git-scm.com/book/en/Customizing-Git-Git-Hooks)
  3. Initialise your local copy of the source as a Git repository (git init)
  4. Add the remote repository. Assuming it's a Windows box you can use an SMB shared folder over the VPN so your remote is "local" as far as Git is concerned. (git remote add tfsserver file:///Volumes/tfsmount/code

Your first push will be expensive (but you could prepopulate the remote repo to get around that), but subsequent pushes would be just the changesets. The post-receive hook would then take care of updating the files, and you're laughing.

Of course, you then get to impress them with how amazing Git is, get them to migrate, and your problem goes away forever :).

Update: Here's a link which describes these steps in more detail, under the guise of updating a remote website: http://toroid.org/ams/git-website-howto.

spikeheap
  • 3,827
  • 1
  • 32
  • 47
  • 1
    Hi @Spikeheap. I am running MSFT's Remote Desktop Connection client on my Mac. I do have a "shared" folder that a) is on my local Mac that b) shows as a network drive on the VM. Actually the TFS is on another machine, not the machine I'm remoting into. So basically all client infrastructure I access via the VMs. I'm currently looking into having git installed on the VM i tap, but being that this is a larger company, not sure how receptive they are :/ – jusopi Feb 25 '14 at 21:57
  • Hmm, sounds like fun. Could you create a network share on the VM for TFS <-> VM? If so you could do a simple rsync to keep the two shared folders in sync, and work on the code in your Mac. Then the edit would be Mac -> VM shared folder, (on VM) git post-commit hook copies to TFS shared folder -> TFS server. Not pretty but wouldn't need manual intervention, and you could use Git on the Mac... – spikeheap Feb 26 '14 at 17:45
  • that;s the route I was hoping to take. My hangups are that I cannot seem to find a useful tutorial on creating a git server post-receive hook. I don't know if it's as simple as creating a shell script or not because many of the API tutorials I see are specific to Atlassian or other git addons. I'm very new to git's more advanced features. – jusopi Feb 26 '14 at 17:49
  • one thing I;m digging around with in parallel is maybe seeing if there is a way to say git archive STAGE --format=zip > archive.zip however the STAGE isn't valid like HEAD or master is. And again, this being an edge-case, I'm having a hard time coming by information on it specific to my problem. Is there just a simple way to say, given these files that have NOT been committed but are staged, dump them into a zip file or copy them over? – jusopi Feb 26 '14 at 17:51
  • Absolutely, adding a hook is trivial :). If you look in the .git/hooks directory you'll see some examples. All you need to do is create a file in there which does the copy. I *assume* on Windows it'll be a batch file (no .bat ending though). If the hook fails you'll get output on your client following the commit. I'd stick to the post-commit hook in preference to trying to infer which files are in a certain state - that's what Git's good at! – spikeheap Feb 26 '14 at 19:11