Insomnia

bash & Subversion command line

I loath GUI utilities for manipulating source control. All my co-workers use TortoiseSVN, but I try to do anything from the command-line.

One thing that can’t (as far as I know) be done from the command line is to bulk add all new files.

So.. I use this:

% svn st | grep ^? |  awk ‘{print "svn add "$2 }’ | bash

  • Posted on October 27, 2011
  • Tagged scm, svn, bash

Echoing text, with line-feeds, in Cygwin bash

The Subversion administrator, at my workplace, has a commit flag that forces commits to include messages with a specific format.

Issue ID XXXXX – Summary
Reviewed By: John Doe
Reviewed On: MM/DD/YYYY
Text of commit message.

Since most of the developers use TortoiseSVN, they can type those values into Tortoise at at each commit. I also believe there might be some custom fields in Tortoise, that help format the message.

Cygwin bash (and any bash, I believe) will ignore line feeds that are wrapped in quotes. So using, % svn commit -m “This is \n a new line”, doesn’t work.

The solution I found was to use the -e flag in echo and echo the output in the commit message parameter.

For example,

% svn commit -m "`echo -e “TTP 21483 – JUnit changes\nReviewed By: John Doe\nReviewed On: 10/25/2011\nAdding tests for FooBar”`"