Crash Course in using Subversion on a daily basis, no administration tasks are covered here.

Subersion Checkout

Easiest task ever, simply locate code you want an checkout to a location.

svn ls https://edoceo-imperium.googlecode.com/svn/
svn checkout https://edoceo-imperium.googlecode.com/svn/ /opt/edoceo-imperium/

Easy! Get a listing (ls) and then checkout to a specific file path.

Subversion Branching

Use this to create a branch directly in the repo.

svn copy https://edoceo-imperium.googlecode.com/svn/trunk \
  https://edoceo-imperium.googlecode.com/svn/branches/dojo-hack

Subversion Switch

Two cases for switching: 1) change repository path

svn info
svn status
svn switch --relocate https://edoceo-imperium.googlecode.com/svn/trunk/ https://edoceo-imperium.googlecode.com/svn/branches/tsmckelvey/

2) choose different codebase (i.e. switch to a branch)

svn switch https://edoceo-imperium.googlecode.com/svn/branches/dojo-hack/

Subversion Merge

Here's a quick sample of a merging process we performed when upgrading Imperium.

cd ../imperium.branch/
svn info
svn status
svn info https://edoceo-imperium.googlecode.com/svn/trunk/
svn merge https://edoceo-imperium.googlecode.com/svn/trunk/
svn status
svn diff | less
svn commit -m'merged in trunk @####'

First collect information about the working copy (info,status), then about the trunk (info). Then merge the trunk to the current working copy (merge). Check the work (status,diff) and commit when happy (commit)

Suversion Conflict & Resolution

Some times, your code will get way out of sync, likely because you were not updating your working copy frequencly.

~ $ svn update
U    work/view/my/profile.php
U    work/view/activity/search.php
U    work/view/signin.php
D    work/view/results.php
D    work/view/search.php
U    work/view/volunteer.php
U    work/view/content.php
Conflict discovered in 'activist/http/svy_list-edit.php'.
Select: (p) postpone, (df) diff-full, (e) edit,
        (mc) mine-conflict, (tc) theirs-conflict,
        (s) show all options: s

  (e)  edit             - change merged file in an editor
  (df) diff-full        - show all changes made to merged file
  (r)  resolved         - accept merged version of file

  (dc) display-conflict - show all conflicts (ignoring merged version)
  (mc) mine-conflict    - accept my version for all conflicts (same)
  (tc) theirs-conflict  - accept their version for all conflicts (same)

  (mf) mine-full        - accept my version of entire file (even non-conflicts)
  (tf) theirs-full      - accept their version of entire file (same)

  (p)  postpone         - mark the conflict to be resolved later
  (l)  launch           - launch external tool to resolve conflict
  (s)  show all         - show this list

In many cases it may be prudent to simply accept what the repository has, so just blindly accept it by choosing "tc" If you need to fully examine the details after the update choose "p", the update will proceed and conflicts can then be resolved manually.

See Also