Bazaar has become a tool I’m using all the time. Using Bazaar as a version control system means using a command line interface. I haven’t found a feature-rich Bazaar GUI tool like the ones that exist for Subversion. I feel alright with using a command line interface for executing commands; but it is frustrating to edit text, review diffs, and manage merges in a command line environment. It just sucks! I want something better: a work-flow that keeps me productive, and an appropriate interface for the task at hand. Specifically, I want my version control system to be integrated with my Mac and the existing tools I use; I want to be able to:
- Manage my files and folders using Finder
- Write commit messages, view diffs, and manager merges in TextWrangler
Moving/renaming files can’t be an issue
Version control systems are suppose to be smart; why do they always have an issue if I move a file to a different folder or change the file’s name? I want to be able to use Finder to manage my files and folders, not a command line interface!
Bazaar handles files I delete; but it also thinks that I’ve deleted one file and added a new file if I change the file’s name in Finder. This is disruptive to my work-flow, and Finder provides a great interface to organize my files; I want to use Finder (and other external applications), not
bzr mv to move/rename files and folders.
automv Bazaar plugin
The automv plugin provides a command,
bzr automv, which will look at your working tree and detect file/folder renames/moves. The plugin uses a configurable threshold to handle a rename/move of a file which also has changes.
Having this plugin installed will allow me to organize my files and folders using Finder (or other apps like Eclipse) without having to worry about moving them again with a Bazaar command. The Finder app provides a much more appropriate interface for dealing with file organization; the automv plugin will allow me to use it and make sure Bazaar understands my intentions.
You can install the automv plugin by branching it
Bazaar can use your plugins directory under the hidden Bazaar configuration directory in your home directory:
$ bzr branch http://bzr.oxygene.sk/bzr-plugins/automv/ ~/.bazaar/plugins/automv/
A CLI is not appropriate for complex tasks
Reviewing and managing merges conflicts are complex tasks; version control systems delegate this task to a human. For a human to manage these complex tasks, using appropriate tools is helpful.
TextWrangler is an awesome text editor for the Mac, offered for free by Bare Bones. There’s a pretty huge list of features, but I’d like to focus on using TextWrangler as an external diff tool for Bazaar.
difftools Bazaar plugin
The difftools plugin provides Bazaar a way to support the use of external diff tools, especially GUI tools.
Reviewing a diff of two files is much easier when the two versions of the file are side-by-side with syntax highlighting. The complex task of reviewing multiple diffs while managing merge conflicts is much better suited for a GUI. The difftools plugin supports many popular GUI diff tools; I’ve found it also seems to work with TextWrangler.
Branching the difftools plugin
Like automv, difftools is available in a public Bazaar repository; it happens to be hosted on Launchpad. You can install difftools in your plugins directory with the following Bazaar command:
$ bzr branch lp:bzr-difftools ~/.bazaar/plugins/difftools/
lp: prefix; Bazaar is integrated with Launchpad and offers this shortcut for Launchpad-hosted projects.
Delegating complex tasks to TextWrangler’s interface
TextWrangler ships with support for command line tools. We’ll have to enable these so we can configure Bazaar to delegate commands to TextWrangler, specifically for diffs, and set TextWrangler as our default editor for Bazaar.
Install TextWrangler’s Command Line Tools
By selecting TextWrangler » Install Command Line Tools… from the menu bar, you’ll have two Unix executables available:
twdiff, both in
You should see a dialog similar to the one below, confirming that the command-line tools are installed:
We’re ready to modify our Bazaar configuration to utilize these command line tools we just had TextWrangler install.
Configuring Bazaar to use TextWrangler
Our last step here is to link up Bazaar commands that will launch TextWrangler. From our earlier step of installing the difftools Bazaar plugin we can create a command which allows us to view diffs in TextWrangler instead of just in a command line interface.
Your Bazaar configuration file is located at:
We can use TextWrangler’s File » Open Hidden… menu option to navigate to and open the Bazaar configuration file since it’s in the hidden Bazaar folder. My configuration file contains the following:
[DEFAULT] email = Eric Ferraiuolo <eferraiuolo @gmail.com> editor = edit -w [ALIASES] twdiff = diff --using twdiff --diff-options --wait
There are two important lines here, first:
editor = edit -w
Which configures Bazaar to use TextWrangler (edit) as it’s default editor with the wait option enabled telling Bazaar to hold the command until you’re finished in TextWrangler. Now doing executing a
bzr commit command in a working tree will open TextWrangler for you to type in your commit message.
The other important line is adding an alias command,
twdiff = diff --using twdiff --diff-options --wait
This line sets up an alias which runs Bazaar’s
diff command with the option to use (
--using) TextWrangler and wait for you to finish with the files in TextWrangler before the command returns. This alias allows you to run:
bzr twdiff in a working tree and delegate to TextWrangler’s interface to review the diff.
I’ve been happy so far with this Bazaar setup on my Mac. I feel much more confident and less frustrated when dealing with my files under version control. I really like that I didn’t have to add any tools or applications to my Mac, just a couple of light-weight Bazaar plugins.
Let me know your thoughts, or about your Bazaar setup on your Mac. I’d be interested to see if you have something I like better. :-)