Setting up SVN with Mac OSX

How to set up and use Subversion in OSX.

0. I neglected to post how to install Subversion see: How to Install Subversion on Mac OS X.

1. Open the Terminal: Applications -> Terminal

2.Set the correct path in the Terminal window:

export PATH=$PATH:/usr/local/bin

3. Test by entering

svn

in Terminal window. Output should be something like:

Type ‘svn help’ for usage

. If the path is correct.
Otherwise it will be:

-bash: svn: command not found

4. Create a repository by adding;

svnadmin create /Volumes/MainBackUp/svn/monopoly

Which creates the files necessary for Subversion.
5. Initial import:

svn import -m “Initial import.” /Users/russell/Documents/workspace/MONOPOLY
file:///Volumes/MainBackUp/svn/monopoly

6. Checking Out A Working Copy
Navigate to correct folder by eg:

cd /Users/russell/Desktop/test

GENERAL COMMANDS

Navigate to correct folder for the following commands:
svn status (Gives overview of changes, use to check folder is working copy)

svn commit NewClass.as –m “New Class committed”

(Commits new file with log message)

svn add AnotherClass.as

(Adds, new file to Subversion)

Terminal Outputs: A AnotherClass.as

svn status –verbose

(gives detailed information of each file and its revision number, will show ‘mixed revisions’)

svn log

(Shows log messages)

svn move oldfilename newfilename

(Replaces old with new filename)

svn mkdi

r (Makes a new directory)

svn delete StateVieo.a

s (Deletes file)

Terminal Outputs:

D StateVieo.as

svn delete –force StateVieo.as

(If above method fails this will force the deletion)

svn rm State.as

(Removes file from Subversion)

svn update –-revision 14

(Updates to specific revision number)

svn list file:///Volumes/MainBackUp/svn/GOF_VIDEO_2

(Lists top level files/ folders in chosen path) Outputs:

.as2_classpath
.classpath
.project
.settings/
assets/
src/

svn list file:///Volumes/MainBackUp/svn/GOF_VIDEO_2/assets -R

(-R Stands for Recursive – will lists all level files/ folders within chosen path)

Outputs:

test/
test/newTest.txt
video/
video/ClearExternalAll.swf
video/video_state.swf
video/video_working.swf
Advertisements

3 thoughts on “Setting up SVN with Mac OSX

  1. Nice blog. It helped me alot.
    But can please suggest me whether Trunk folder is needed or not while setting up the SVN for the projects as many people used to suggest to create that.
    But u have mentioned any thing about trunk folder while creating the repository

    Thanks & Regards
    Vivs

    • Its normal ‘good practise’ to create a set of ‘branches’, ‘tags’ and ‘trunk’ folder for each project. Working on a branch folder such as ‘v_2_1’ , whilst periodically Merging to the trunk. The ‘trunk’ folder will have no version folders, whilst the ‘tags’ and ‘braches’ folders will.

      See Subversion Best Practices

  2. Hi,
    Sorry about the delay in replying.

    The svn directory I created is on an extrenal drive – /Volumes/MainBackUp

    The ‘svnadmin create‘ Command makes origianal empty Repository (If I remember correctly using a pre-existing folder, or one is not present creates a new directory). Files needed by Suversion are created like the .svn file.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s