Ralf Albert
Ralf Albert

Reputation: 139

svn commit from bash script without opening the editor

I try to write a bash script which should commit to a svn repo. Everything works fine until the point where I try to commit. The commit command opens the editor and the script ends with an error that the commit message was left in svn-commit.tmp

I try a couple of things but none will work

commit_msg="$1"
svn commit -m "$commit_msg"

and

commit_msg="$1"
svn commit -m '$commit_msg'

and

commit_msg=$1
svn commit -m '$commit_msg'

and all with the -q and --non-interactiveoperators. Even svn commit -m "woohoo" opens the editor and the script ends with the error.

Any ideas why it is impossible to commit within a bash script without opening the editor?

Upvotes: 4

Views: 5109

Answers (2)

Ralf Albert
Ralf Albert

Reputation: 139

After I tried svn ci instead of svn commit, everything was fine. My first thought was a buggy version of svn. Asking the Great Dump (aka Google) I found the solution:: In my .bash_profile was a code snippt that forced the svn commit always to open the editor while svn ci worked as expected.

I don't know exactly where the code snippet came from, but windows users have to fight a lot of mysterious behaviours.

Thanks all for your help.

Upvotes: 1

Winfield
Winfield

Reputation: 19145

You should use the --non-interactive option on the svn command:

svn commit --non-interactive -m '$commit_msg'

Upvotes: 3

Related Questions