MethylBlue
  1. Filelight
  2. Codeine
  3. Wocka
  4. Blog
  5. Detritus
  6. Home
RSS

Using TortoiseSVN from the Command Line

I like to use CygWin, I find, at least for development, it preferable to use the command line to explorer for opening and manipulating files. However TortoiseSVN is better than command line SVN in a few important areas. So I made a script so that “svn ci” open Tortoise’s check-in dialog. Ace! :)

  1. Save this script to /usr/local/bin/svn (ie. c:\cygwin\usr\local\bin\svn)
  2. Ammend the svn variable
  3. chmod u+x /usr/local/bin/svn

As long as /usr/local/bin is first in the path, you can use TortoiseSVN for the good bits, and the command line svn client for the rest.


#!/bin/sh
# Use TortoiseSVN from the cli
# Public Domain, Max Howell 2008

path=$2
test -z $path && path=.
test -e $path && path=`cygpath -wa $path`

svn='/cygdrive/c/progra~1/TortoiseSVN/bin/TortoiseProc.exe'

function svn
{
"$svn" /notempfile /command:"$1" /path:"$path" &
}

case $1 in
up | update) svn update;;
ci | commit) svn commit;;
log) svn log;;
props) svn properties;;
browse) svn repobrowser;;
*) /usr/bin/svn $@;;
esac

You can also use your ssh key from cygwin through TortoiseSVN. Some details here.

But the gist is use this, C:/cygwin/bin/run C:/cygwin/bin/ssh, in the ssh program box in TortoiseSVN network settings.

3 Responses

  1. How to get this script to work when TortoiseSVN is installed in a path with spaces? For example:

    svn=’/cygdrive/c/Program\ Files/TortoiseSVN/bin/TortoiseProc.exe /notempfile’

    Please reply to adamb_eyahoo.com. Thanks!

    Adam B.E

    adambe Identicon Icon adambe
  2. I amended the script above, just add quotes around the $svn usage.

    I suggest avoiding using spaces in paths that contain tools.

    Max Howell Identicon Icon Max Howell
  3. That resulted in a “No such file or directory” error.
    Below you may find a working fixed version which I’ve tested.
    Changes:
    1. Get the falg ‘/notempfile’ outside the quotes… which fixes the error. Is there a way not to keep typing “$svn” /notempfile without getting the “No such file or directory” error?
    2. Use `cygpath -was $path` to get the dos short name of the path - this supports more Window paths.

    Please reply to adamb_e AT yahoo.com for comments.
    Thanks, Adam.

    #!/bin/sh
    # Use TortoiseSVN from the cli
    # Public Domain, Max Howell 2008

    path=$2
    test -z $path && path=.
    test -e $path && path=`cygpath -was $path`

    # Don’t put a backslash if the path contains spaces.
    #svn=’/cygdrive/c/Program Files/TortoiseSVN/bin/TortoiseProc.exe’
    svn=’/cygdrive/c/dev/tools/TortoiseSVN/bin/TortoiseProc.exe /notempfile’

    case $1 in
    up | update) “$svn” /notempfile /command:update /path:”$path”;;
    ci | commit) “$svn” /notempfile /command:commit /path:”$path”;;
    log) “$svn” /notempfile /command:log /path:”$path”;;
    props) “$svn” /notempfile /command:properties /path:”$path”;;
    browse) “$svn” /notempfile /command:repobrowser /path:”$path”;;
    *) /usr/bin/svn $@;;
    esac

    adambe Identicon Icon adambe

Leave a Reply