04 Mar

Quick look at subversion / svn commands – overview

About Subversion:

Subversion, also known as svn, is a version control system much like the Concurrent Versions System (CVS). Version control systems allow many individuals (who may be distributed geographically) to collaborate on a set of files (typically source code). Subversion has all the major features of CVS, plus certain new features that CVS users often wish they had. This package includes the Subversion client (svn), tools to create a Subversion repository (svnadmin) and to make a repository available over a network (svnserve).

Below is an introductory part for regular usage and basic details for working with SVN, performaing different tasks with SVN. Detailed information can be surely obtained from the Subversion site

Regular SVN Commands:

svn –help // obtaining commandline help from svn
svn add filename // adding file to svn
svn add directory // adding directory to svn
svn ci filename -m “message” // checking in/commiting a file to svn
svn commit –message “message” filename
svn ci foldername -m “”

Creating a tag from trunk:

svn copy http://path/to/repository/trunk http://path/to/repository/tags/TagName -m “Message for Tag Release ”

Creating a tag from branch:

svn copy http://path/to/repository/branches/branch_name http://path/to/repository/tags/TagName -m “Message for Tag Release ”

Switch tag/branch/trunk to specific location:

svn switch http://path/to/svn/repository/tag /target/path/

To switch from old svn repository url to newer:

svn switch –relocate http://path/to/svn/repository/tag http://new/path/to/svn/repository/tag

We shifted our repository to newer location. The tags created from earlier repository were still pointing to older SVN Repository path. To correct that we must relocate the point of current settings to newer location.

Cleaning up subversion files caused by escaped processes and crashed:

svn cleanup

Difference between SVN repository with present changes:

svn diff filename
svn di filename

Difference between two SVN Revisions:

svn diff -r rev1:rev2 filename

List directory/file under repository

svn list directory
svn ls directory

Display information about file or directory including Date modified, author, revision, path in repository.

svn info filename

Show the Subversion log messages for a set of revision(s) and/or file(s) and/or all directory contents in repository.

svn log filename
svn log .
svn log http://path/to/file
svn log -v .
svn log -r RevisionNumber http://path/to/file

Create / Rename Directories in SVN:

svn mkdir directory
svn mkdir http://path/to/directory
svn move directory1 directory2
svn mv directory1 directory2
svn mv file-old-name fil-new-name

Undo changes to local file with respect to SVN Version:

svn revert filename

Mark files Resolved after resolving conflicts in file:

svn resolved filename

Check status of file/directory in SVN:

svn status
svn st

Meanings of Status’s first column:

U: File to be updated
A: File to be added
D: File to be deleted
R: File to be replaced
G: File to be merged
C: Conflicting changes
X: Resource is external to repository (svn:externals)
?: File/directory not under version control
!: File/directory missing
‘ ‘: no modifications
C: Conflicted
M: Modified
*: Local file different than repository. File will be overwritten with the updated version from the server, if you perform an update.
L: locked
S: switched to a branch

Retrive latest commited changes from SVN Repository to your local copy

svn update
svn up

Leave a Reply

Your email address will not be published. Required fields are marked *

*

-- Kedar Vaijanapurkar --