Home » linux » Working with subversion – II

Working with subversion – II

In previous article, I discuss some basic functions of svn. Now i will discuss some more handful features for svn.

But first one disclaimer I will only show some basic example for svn commands. They are very powerful and can be used with variety of parameter to achieve required results.

First sometimes we need to know about our svn setup. So svn info comes as handy here.

$ svn info
URL: https://svn.yourdomain.com/project123/branches/dev
Repository Root: https://svn.yourdomain.com
Repository UUID: 3aaa9e22-3660-1222-1111-ccca444822
Revision: 10
Node Kind: directory
Schedule: normal
Last Changed Author: User1
Last Changed Rev: 10
Last Changed Date: 2013-03-13 01:23:12 +0530 (Wed, 13 Mar 2013)

As you see it gives information like SVN url total revision last commited revision info etc.
Some times we will need to analyze the changes log. For that svn log command is very handful.
Syntax : svn log <File Path>

$ svn log test.php
------------------------------------------------------------------------
r2 | user2 | 2013-03-13 01:23:12 +0530 (Wed, 13 Mar 2013) | 2 lines
some changes
------------------------------------------------------------------------
r1 | user1 | 2013-03-13 01:14:14 +0530 (Wed, 13 Mar 2013) | 1 line
First code commit

This is helpful to check which user commited which version. You can also track down the previous version file contents through svn cat command
Ex. for check test.php for version 123

Syntax : svn cat -r<revision> <File Path>

Example

$ svn cat -r123 test.php

For save into file to analyze, use bash stdout like that

$ svn cat -r123 test.php > test-prev.php

One more command is very much used for track down changes between versions and that is svn  diff

Syntax : svn diff <File Path>

Example

$ svn diff test.php

Above command returns the difference between latest commited version and uncommited changes for test.php. You also can check difference from any particular revision by pass revision.

Syntax : svn diff -r<revision> <File Path>

Example for Changes in test.php after version 4.

$ svn diff -r4 test.php

Their are times when you need structure without svn footprints (folders/files related to svn ) Example to upload somewhere. You need svn export command.

Syntax : svn export <Folder Path to export structure >

Example

$ svn export /home/user/backups/

It will create project123 folder into /home/user/backups/. Remember it will create folder, you should not create folder at that path with same name.

I hope these cheat sheet for svn is usable for readers

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s