Almost everyone has more than one computer, and you’ve probably got multiple machines you’ll need to synchronize your code onto. To handle this I use Bazaar distributed version control. If you’re experienced with various VCS and are in need of convincing, see Why Switch to Bazaar?
Here are the main places I have to synchronize to and the reasons for doing so:
Linux Notebook
This is where I write most of my code and I mainly use Bazaar here as a way to keep a changelog and sometimes revert changes. It’s also nice to be able to get some quick stats. You can also create a repository within another, for example, if some piece of code starts to grow legs of it’s own.
Windows Machine
I keep a Windows install for gaming, but I do have Eclipse and Cygwin installed here. I simply use Bazaar to check out and test my code. Windows-specific changes are usually made from here and need to make their way back to my Linux machine for further testing.
Web Server
This is where I push all my public code. For things I’ve open sourced, the address is http://bzr.santiance.com/ and anyone can branch this. Release early, release often. For proprietary work this would be a private server. I authenticate via SFTP, but regular FTP is also supported.
The Public
When someone makes changes to my code the way I synchronize is with Bazaar or a patch. Some simple changes only require a patch, but more elaborate changes warrant a merge.
At any time all three of these can have different copies of the code. Bazaar handles merges quite gracefully, and when there is a conflict it’s quite clear how to resolve it. Before I truly embraced this system I was able to navigate my way through armed with just the 5 minute tutorial.
Example
I usually start by developing something on my Linux notebok, but I do the same thing from within Cygwin if I do develop something starting on a Windows machine. On Linux I keep my Eclipse projects in ~/workspace/, and in Windows I keep them in C:\cygwin\home\kris\. After I’ve crafted up something I’ll create a repository and add the project files and source code then commit my changes:
bzr init
bzr add src
bzr add .project
bzr commit
Supply the changelog information and Bazaar will have saved this initial commit. Now I like to get my code to either the public server or private development server if the work is proprietary. I do this by:
bzr push sftp://user@bzr.santiance.com/projectname
One great thing about Bazaar is that you can push/pull changes from all kinds of places. If I don’t have (internet) connection to my web server, I can push/pull from my Windows and Linux machines over SFTP or a network mount. I can later push these changes back to the web server, so I get some data redundancy to help avoid losing code.
For clients that don’t want to use version control, which sadly do exist, you can easily take a snapshot of the code to be sent:
bzr export TheProject.tar.bz2
You can change the archive file type by modifying the file extension. I most commonly use .tar.gz, .tar.bz2, and .zip for my projects.
BZR vs GIT
So, why do I have a Github account? Mainly because other projects I’ve worked with use git, since most of my original work would find it’s way to Launchpad. Both Launchpad and Github make it easy to submit changes from the command-line once you’ve got an account. Luckily Bazaar has plug-ins that make working with repositories in another format much easier for us.
When it comes to the argument of simplicity and low barrier of entry, my hat’s off to Bazaar. It’s handled every scenarios I’ve thrown at it, and my projects have survived the advancement of their storage format from pre 1.0 to (now) post 2.0. Both tools are equally capable, but Bazaar’s interface is more intuitive.
Send hate and flames @KristopherIves