NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

Getting Code in and out of Subversion Tortoise

SVN Book pg 21 Subversion Architecture Diagram

Lock-Modify-Unlock Model can do this in SVN, but it is not cool. Copy-Modify-Merge Model is the way SVN operates and is optimistic.

Components Usually Have:

  • Trunk - main code housed here
  • Branches - under development/ not in production
  • Tags - ID a release level of revisions in trunk

Subversion on Linux: Command Line Instructions

Help for SVN commands:

% svn help import
% svn help mkdir

Import Code to Subversion

% svn import -m "Your Import Message" /path/to/FileOrFolderName \
Authentication realm: <> nccoos
Password for 'uid':
Adding         file.ext

Committed revision 47.

Make Branches/Tags Subfolders

% svn mkdir
% svn mkdir 

Create a Working Copy - SVN Checkout

% svn co \

Commit Changes Back to the Repository

% svn update /path/to/WorkingCopy
% svn ci -m "comments" /path/to/WorkingCopy/  

Subversion on Windows: Tortoise SVN

Create a Component

  • Right Click to get Explorer Menu -> TortoiseSVN -> repo-browser
  • Navigate to project of interest - right click
    • Create folder... - component name
      • navigate to new component - right click...
        • Create folder... - "trunk"
          • Create folder... - component name
        • Create folder... - "branches"
        • Create folder... - "tags"

Import Code to Subversion

  • Sub folders ready? Right click on local folder containing code to version control
  • Choose Import in TortoiseSVN sub-menu
    • typical URL: (e.g
    • Best practice = use trunk framework
      • like trunk /component
    • authenticate: UID and PW same as trac
  • Files are then added to SVN
    • Version numbers increase on an entire repository basis
    • Adding new component will increase the entire repository version number

Create a Working Copy - SVN Checkout

  • Right click (anywhere outside of a toolbar or application) and choose SVN Checkout from Explorer Menu
  • Select the URL of the repository of interest
  • Pick/Create a local Checkout Directory to create a Working Copy
  • Choose the Head Revision or a Revision Number
  • Folder is created: green check mark = folder has not changed from Checkout
  • A .svn folder is also created on Checkout to hold Subversion bookkeeping - don't mess with this folder!
  • Ready to make changes to code

Commit Changes Back to the Repository

  • Can commit single changed file or entire container folder
  • Right click and select SVN Update to check that files have not been changed since initial Checkout
    • If files have changed
      • Merge: other changes do not overlap your changes)
      • Resolve Conflicts: other changes do overlap your changes
  • No external changes - right click on file or folder and select SVN Commit
  • Add comments to describe the changes being committed

Export Code to Deploy

  • Right Click -> Explorer Menu -> TortoiseSVN -> Export - like Checkout but with no bookkeeping

Remove an Entire Component

  • Explorer Menu -> TortoiseSVN -> repo-browser - can remove an entire Component
    • Removal actually creates a new version
  • Can export a previous version to access removed component code

Working With Tags & Branches

  • Using a working copy with trunk folder at least checked out
  • Right Click on trunk folder -> Explorer Menu -> TortoiseSVN -> Branch/Tag
    • select Tag URL: like Tags /tagname (i.e v1.0)
    • add comments
  • Tag is created (really a pointer)
  • Can checkout Tags folder - but not recommended
  • Usually work on the head revision in trunk
    • until experimental or multiple people working on code - then branches