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

Last modified: March 9, 2014

Author

Comments

Write a Reply or Comment

Your email address will not be published.

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

This site uses Akismet to reduce spam. Learn how your comment data is processed.