SVN for School Projects

From CDOT Wiki
Revision as of 09:28, 13 February 2012 by Fardad (talk | contribs) (Kick-start a project (project initiation))
Jump to: navigation, search

What is svn?

svn (Subversion) is a source code repository. It is a program capable of storing the source code of a project and keep track of all the changes made (contributions) by its developers.

What svn can do for you?

  • Stores your work (source code) safely on a remote server so you will never lose your work.
  • Lets several students work on the same project at the same time.
  • Keeps track of all the work done with history (who have done what, and when), this means you can:
    undo your work to any of the past stages of the work.
    look at different stages of the work and see all the changes.
    check other team members' work, their progress and contribution.
    ask for help from others to help you with your work and help others with their work.
  • to be continued...

Common actions for school projects

Kick-start a project (project initiation)

  1. create a directory to do your work
  2. checkout the repository (the whole thing) into the directory
    Look and make sure you have the 3 directories (branches, tags, trunk)
  3. Open branches directory and create a directory using your login name
    this becomes the root of your (each students') workshop
    note: do not use the operating system's file management to copy, move, etc any of the 'versioned files
  4. Do an update on the whole repo to see all the changes from all studens
  5. branch the trunk into a sub-dir of your workshop
    branch as verb, means copy (in repository)

You are good to go to start working on your repository

start working on a project

Start a task

Continue working on a task on a new computer

Continue working on a task (everyday work)

Release a completed task (Submitting an Assignment or a Release)

Standard svn tree structure

Directory Structure

|-- Team_Repository_Account
  +--branches
  | +-- member-id1  <-- this is a team member's home within branches
  |   +-- Task1
  |   +-- Task2
  | +-- member-id2  <-- this is a team member's home within branches
  |   +-- Task1
  |   +-- Task2
  |   +-- Task3
  | +-- member-id3  <-- this is a team member's home within branches
  |   +-- Task1
  +--tags
  | +-- R0.1
  | +-- R0.11
  | +-- R0.2
  | +-- R0.21
  | +-- ...
  | +-- R0.5
  | +-- ...
  | +-- R1.0
  | +-- R1.1
  | +-- R1.2
  | +-- R1.21
  +--trunk

branches

  • branches is the common directory for all team members' workspaces.
  • Each team member should create their own home directory or workspace (member-id1, member-id2,...) for their own development tasks within branches.
  • Each team member should divide their workspace into several sub-directories (workspaces) during the development of the project. These workspaces(Task1, Task2, ...) are usually copies of the trunk to be worked on.
    These sub-directories(Task1, Task2,...) are called branches of trunk. When the word branch is used as a verb, it means copying the whole trunk into a sub-directory, either in branches.

tags

  • tags is the directory that holds copies of successful stages of trunk throughout development. (Also called as Milestones)
  • tags are never modified or edited. You may branch a directory of tag into branches under a workspace and then modify the branch and apply the changes back to trunk, but you should never change the contents of a tag
  • The action of branching the trunk into tags is often referred to as a release.
  • We use the tags directory to submit the work for marking. Your instructor will specify the requirements of a release.
    • A release is usually tagged by a version number like: R0.1, Prj0.2, As1_1.0
    • When a release is due, your instructor will always mark the latest version of that release.
      If R0.3 is due, and R0.3, R0.31, R0.32 are present in tags, then your instructor will mark R0.32

trunk

  • trunk is the directory that holds the project in its current stage, complied and run-able
  • trunk should never hold non-compiled code. Usually trunk is an exact copy (or better than) the latest version in tags.
  • If the repository only contains one project, then trunk has no project level sub-directory and is the root of the project. Ifthe repository holds more than one project, trunk is divided into several sub-directories - one for each project.
    In this case, we divide tags into exactly the same project sub-directories as present in trunk

Svn basic commands