This is an old revision of the document!


Subversion

Project Manipulation

Project Directory Structure

Organize your code to import into the following structure:

myproject/
myproject/branches/
myproject/tags/
myproject/trunk/
myproject/trunk/dir1/
myproject/trunk/file1
...
  • trunk - the main line of development, the leading edge, where developers usually commit their regular changes.
  • tags - a collection of snapshots of the trunk (or a branch) at a user-defined point in time, for instance release day.
  • branches - active variations of the project compared to the trunk (or even another branch). This is useful when working out a (big) change that needs to be coordinated in a team or when using a single working-copy for the work with the changeproject is not feasible.

Importing/ Creating a Project

Assuming the project directory is a subdirectory of the current directory, you would enter the following command:

svn import project file:///path/to/repository/newproj_name -m "First Import"

e.g.,

svn import Logic file:///home/courses/cs297/shared/svn/Logic -m "First Import"

Checking Out a Project

svn checkout file:///repository_name/project/trunk project

Adding Files or Directories

svn add file_or_dir_name

Deleting Files or Directories

svn delete file_or_dir_name

Committing Changes

 svn commit

Updating Files

svn update
Code Meaning
A Added
D Deleted
U Updated
C Conflict
G Merged

Tagging a Version

To give a version of the project a name, use svn copy

svn copy file:///path/to/repos/project/trunk \
         file:///path/to/repos/project/tags/release-1.0 \
    -m "Tagging the 1.0 release of the project."

Conflicts

Conflicts can be detected with the update command. When Subversion detects a conflict in a file, it places conflict markers into the file (to allow the user to find the places of the conflict) and creates the following three files in the directory:

  • filename.mine

The file without the conflict markers

  • filename.rOLDREV

The file as it was before I started to change it.

  • filename.rNEWREV

The HEAD revision of the file

Resolving conflicts Conflicts can be resolved by doing one of the following three things:

  • Merge the conflicting areas (conflict markers)
  • replace the file in question with one of the three files mentioned above
  • running svn resolved

Creating a Repository

svnadmin create /path/to/repos

The actual repository/directory should not have been created yet. This command will handle that for you.

Using ssh with svn

Use the svn+ssh:// URL schema to connect.

Example:

svn list svn+ssh://host.example.com/repos/project
harry@host.example.com's password:

Subclipse with Eclipse

  • Plugin for Eclipse
  • Installation:
    • Help –> Eclipse Marketplace
    • Search for (Find:) Subclipse
      • Select “Subclipse 1.8.22”
      • Go through the installation process
    • After installing, under preferences
      • Under Team > SVN
        • SVN Interface: Client:
          • select SVNKit (Pure Java)

Set Up Repository

  • Repository (works from home computer too):

svn+ssh:username@serac.cs.wlu.edu/svn/csrepos/<repository_name>'' ==== Subclipse with Eclipse on Windows ==== * In Eclipse, Windows –> Preferences * Team –> SVN * Interface: switch client to Pure Java

labs/subversion.1415112862.txt.gz · Last modified: 2014/11/04 14:54 by admin
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0