Turn Current Working Trunk Into a Branch in SVN

So you start working inside of a trunk checkout of a Subversion repo, thinking that you will just be making a quick update. Once you start working, you realize it might have been better to make a branch to work on the feature separately from the trunk? Fear not! As Floyd Price from CodeSpaces points out, the process is pretty simple when you think about what you want to get done.

Technically, if you have not committed the changes into the trunk yet, you are dealing with the most up to date version of the trunk. If you were create a new branch from the trunk, they’d both be on the same page, sans your new edits.

Your current trunk checkout: A + B
               A new branch: A

To make the new branch, run:

#svn cp trunk_repo_path branch_repo_path/new-name
  svn cp http://example.com/repo/trunk http://example.com/repo/branches/new-branch

Now, in your current trunk repo check out you’ve been working in, switch the URL to be the new branch

svn switch http://example.com/repo/branches/new-branch .

If you run `svn st`, you will see the same modified files, but if you run `svn info` you will see the checkout’s URL now points to the branch, and you are free to commint

svn commit -m "first of commit new feature"

Hope this helps.

Why does my autospec keep looping?

After following all of the most up-to-date tutorials I could find, making sure I installed all of the latest gem releases, and just trying to be diligent overall, I couldn’t figure out why my autospec kept looping. In particular, it loops when there are Cucumber features being run ( by setting AUTOFEATURE=true before running autospec ). If you search around on Google, you will find a whole mess of articles with other people having the same issue, and all solutions seemed to come from this one article: http://www.ruby-forum.com/topic/183578 . After reading that, life was glourious for all, David Chelimsky to the rescue! From his life-saving post…

If you use Autotest with Ruby on Rails, be sure to gem install autotest-rails when you upgrade to ZenTest-4.1.0.

Without that gem, when you run the autospec command that ships with RSpec, Autotest won’t won’t have any way of knowing it’s in a Rails app and it will load up rspec’s autotest/rspec.rb instead of rspec-rails‘ autotest/rails_rspec.rb.

Absolutely brilliant! I run to my console, upgrade my gems … and it still loops! Determined not to give up, I did what any smart person would do, ask someone else.

After about a half-hour of frustration of wheel-spinning, Steve Walker and I were finally able to bang out a solution that just may work for you.

About half way down the github wiki for Cucumber, you will see a section titled “Other ways of running features” in which they advise you to put this in your cucumber.yml file

autotest-all: --require features --require lib --format progress features
autotest: --require features --require lib features  
default: --format pretty
html: --format html --out features.html

This is a little out of date, most likely written before RSpec moved to autospec, and all hell breaks loose presumably because we are still configuring it to point to autotest.

In conclusion, drop in this …

autospec-all: --require features --require lib --format progress features
autospec: --require features --require lib features  
default: --format pretty
html: --format html --out features.html

…and let me know if it fixes it.

Happy red/green/re-factor-ing!

Ruby 1.9.1 & Textmate Don’t Play Nicely Together

Ruby 1.9.1 has been out for a long time now, so you may feel pretty comfortable about installing it on your box and doing to the big “let’s see what this broke” game with Rails. We’ll I just wanted to give you a little heads up with another program you may have not expected issues with, Textmate.

What? The Horror! Not being able to code Ruby with Textmate. Well, fortunately, that is not entirely true. You can still use the infamous editor to edit you Ruby code, no problem. The issue comes when trying to use any of the generators or functions that require you to execute Ruby code. You may find yourself running into this puzzling error:

invalid multibyte char (US-ASCII)

For those of you not in the know, the handling of different character types have changed in Ruby 1.9 and Textmate’s latest release does not accommodate this change.

I will update this with any updates, in terms of fixed Textmate versions or any other reliable solutions.