Table of Contents
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
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"
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
Tagging a Version
To give a version of the project a name, use
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 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:
The file without the conflict markers
The file as it was before I started to change it.
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
svn+ssh:// URL schema to connect.
svn list svn+ssh://host.example.com/repos/project email@example.com's password:
Subclipse with Eclipse
Subclipse is a plugin for Eclipse that allows users to easily use Subversion with their code.
- Help –> Eclipse Marketplace
- Search for “Subclipse”
- The first one that pops up should be something like Subclipse 1.10.##
- Select it and click “Install”
- Select All (Subclipse, SVNKit, …)
- Go through the installation process, restart the workspace
- Under preferences
- Under Team > SVN
- SVN Interface: Client:
- select SVNKit (Pure Java)
- Under Team > Ignored Resources
- Add patterns for .classpath, .project, .settings
- These are files that are user-specific and should not be part of the shared repository.
Set Up Repository
- Repository (works from home computer too):
The Team menu is where you'll find the commands you need to work with the subversion repository.
Subclipse with Eclipse on Windows
- In Eclipse, Windows –> Preferences
- Team –> SVN
- Interface: switch client to Pure Java
SVN GUI Clients
Of course, you may not want to use the command-line.
- SmartSVN – free community version
- PyCharm and other IDEs have plugins or built-in clients available