Howto use command line SVN on Mac OSX

Objective Use the command line SVN client on Mac OS X

Subversion was built to be used with the command line subversion client (not the bastardized GUI clients that are being sold on the market right now).

As such my instructions are for the native command line subversion client “svn”

Instructions

These instructions detail how to checkout code, create a commit/add script, and execute that script

CHECKOUT CODE

  1. Start terminal
  2. Paste in commands below (replace “REPLACEME” with your username/password on third line, yes that period at the end line three is intentional), hitting enter after each command:
 mkdir -p ~/Documents/svn/someproject
cd ~/Documents/svn/someproject
svn co https://svn.example.com/ --non-interactive --username REPLACEME --password REPLACEME --trust-server-cert .

MODIFY FILES

Change or modify files in your finder at “Documents/svn/someproject” (do not replace with any files already in source control)

CREATE CHECK IN SCRIPT

You only need to do this once

  1. Open up your favorite text editor that can save files as plain text (Ex: TextWrangler, TextMate, BBEdit, SublimeEdit, etc)
  2. Paste this in:
  #!/bin/bash
SVN_PATH_TO_COMMIT='~/Documents/svn/someproject'
SVN_USERNAME='REPLACEME'
SVN_PASSWORD='REPLACEME'
cd $SVN_PATH_TO_COMMIT
svn add \
    --non-interactive \
    --trust-server-cert \
    --no-auth-cache \
    --username $SVN_USERNAME \
    --password $SVN_PASSWORD  \
    --force $SVN_PATH_TO_COMMIT/* \
    --auto-props --parents --depth infinity -q
svn ci --non-interactive \
    --trust-server-cert \
    --no-auth-cache \
    --username $SVN_USERNAME \
    --password $SVN_PASSWORD \
    -m "auto commit"

  1. Replace “REPLACEME” with your username/password
  2. Save the file as “/Documents/svn/commit_files.sh”
  3. Switch Back to the terminal type in this command then hit enter:
  chmod +x ~/Documents/svn/commit_files.sh

ADDING/CHECKING IN FILES

  1. Open Terminal
  2. Type this in and hit enter:
  sh -x  ~/Documents/svn/commit_files.sh

Additional Resources

SVN cheat sheet

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>