Search code examples
virtual-machinevmwaredevelopment-environmentrsync

coding in a ubuntu VM on laptop and desktop


What is the best way to manage code between VMs and a central SVN repository?

To be more specific, I have a desktop with a linux VM environment, as well as a laptop with a linux VM environment. Both are running under VMWare workstation. I switch back and forth between desktop and laptop all the time, but have trouble keeping the desktop and laptop in sync.

The most obvious--yet probably least efficient--choice is to just commit everything before I switch machines. However, this leads to committing code that is partially complete, just so I can work on a different machine.

I've considered using something like rsync to keep my two development environments in sync. I think this would be better because then I can still commit changes to svn when I want to, while keeping both desktop and laptop in sync.

So while I'm tempted to go the rsync route, I'm still concerned that I have to proactively sync things. In my case, I'm picturing a scenario where I'm working on something on my desktop, then leave to go to a coffee shop to do work with my laptop, only to realize that I didn't sync before leaving the house (DOH!).

I don't know if there's really any way around this. Maybe I could rsync everything to a centralized server that's always online? And set up cron jobs to run every few mins or whatever to sync with my various development environments?

Is there a better option?


Solution

  • You could consider using distributed version control instead. If you don't have the ability to change the central server, there are still wrappers like git-svn that allow you to use git on your end, while interacting with a Subversion server.

    The workflow in a DVCS setup:

    1. Make changes on machine #1, committing locally, repeat.
    2. At switch time, commit locally.
    3. Pull or push changesets from machine #1 to machine #2
    4. Continue work on machine #2.
    5. At switch time, commit locally.
    6. Pull or push changesets from machine #2 to machine #1
    7. Repeat

    When it's time to actually push to the server, whichever computer you're on should have the latest code and you can push up to the master server (SVN or whatever).

    This does make you commit intermediate changes - but I've found that to be more of a benefit of using a DVCS than a burden.

    An alternative to this might be to keep your whole dev directory in a Dropbox folder or some equivalent. Then you don't have to deal with rsync or anything yourself, but you have less control over syncing.