Browsing the archives for the svn tag.

Subversion – Checkout Older Revision

Examples

The SVN syntax for reverting to a previous version of a file is less than obvious. If you want to pull down a previous version of a file type you must first choose a version:

svn log FILE_NAME

This will list all the changes to the file. Next, you pick the revision you are interested in and then type:

svn up -r REVISION_NUMBER FILE_NAME

This will pull down the older version/revision of the file. Next, we are going to rename the file:

mv FILE_NAME FILE_NAME.good

The next step is to pull down the current version of the file:

svn up FILE_NAME

After that is done we are move the “good” file on top of the latest version:

mv FILE_NAME.good FILE_NAME

Now commit the change:

svn ci FILE_NAME

It seems like there should be an easier way without merging so if anyone knows an easier way, please post it!

No Comments

SVN Property Edit – Ignore

Config

If you have a list of files in a source repository that you would like SVN to ignore you can specify them by issuing the following command:

svn propedit svn:ignore .

This command pushes you to an editor window where you simply add the files/directories you would like to exclude from the repository.

Once dirctories have been added, you’ll no longer seem them flagged when you type:

svn status

Typically, people tend to add their build directory and similar temporary files/directories.

Don’t forget to commit your changes:

svn commit .
No Comments

Enable SVN Keyword Properties

Config

If you would like SVN to replace keywords and it’s not enabled by default then execute:

svn propset svn:keywords Id FILE_NAME

E.g.,

svn propset svn:keywords Id Test.java

In your source file you need to add: “$Id”.

E.g.

/**
* Test class.
* @author John Smith
* @version $Id$
*/
public class Test {

After you commit the file, it will look something like:

/**
* Test class.
* @author John Smith
* @version $Id: build.xml 10 2008-06-15 18:12:42Z john $
*/
public class Test {
No Comments