Subversion

Change repository location of your local copy

svn switch --relocate <current_repository_path> <new_repository_path>

Revert to a previous revision (undoing changes)

svn merge -r <current revision>:<previous revision> .

This will only alter your local copy. Then you will need to commit these changes.

Example:

svn merge -r 801:795 .
svn commit -m 'Reverted to revison 795'

Recursively applies changes from revision 801 to 795 (backwards):

  • applies changeset to get revision 800
  • applies changeset to get revision 799
  • applies changeset to get revision 798
  • ...
  • applies changeset to get revision 795

Reference: Subversion: Undoing Changes

SVN server

Launch SVN server as a daemon:

svn serve -d -r <folder_path>

The repositories in the folder are accessible at this URL:

svn://<host>/<repository_name>

Example: there is a repository folder named “toto” on maestric.com in /Users/jerome/svn. First I launch the SVN server:

svn serve -d -r /Users/jerome/svn

Then I can access it:

svn checkout svn://maestric.com/toto

svn+ssh

Checkout syntax

svn co --username jerome svn+ssh://maestric.getmyip.com/Users/jerome/svn/maestric_redesign_summer2008 maestric2008

Notes:

  • no colons between server name and folder path
  • ssh username is choosen with --username

Use a custom SSH port

On the client, edit ~/.subversion/config. In the tunnels section add

sshhome = ssh -p 2222

Then when you checkout:

svn co svn+sshhome://...

Prevent .svn folder web access with .htaccess

RewriteRule ^(.*/)?\.svn/ - [F,L]
ErrorDocument 403 "Access Forbidden

Properties on folders

Set a property:

svn propset <property_name> '<property_value>' <folder_path>
svn propset my_info 'exxxtreme' photos/other;

To set several values, use a text file, one property per line:

svn propset <property_name> -F <file_path> <folder_path>

Delete a property

svn propdel <property_name> <folder_path>

List properties

svn proplist -v <folder_path>

Example: ignore HTML files in toto folder

svn propset svn:ignore '*.html' toto

Display ignored files

svn status --no-ignore

Misc

Show author and revision information for each line:

svn blame <file>

Subversion SVN bug with SSH: "Name or service not known"

SVN over SSH (svn+ssh) stopped to work one day, I don't know why:

svn update
ssh: maestric.getmyip.com:: Name or service not known
svn: Connection closed unexpectedly

When performing an svn info:

Path: .
URL: svn+ssh://jerome@maestric.getmyip.com:/Users/jerome/svn/maestric_web/wiki/data/pages/css

I noticed a colon had been added between the hostname and the repository path! To fix it I did:

svn switch --relocate svn+ssh://jerome@maestric.getmyip.com: svn+ssh://jerome@maestric.getmyip.com
 
write a message
Name


City


Email (won't be displayed)




Antispam: enter the current year (2008)