How to install subversion client on Linux server?

Svn (subversion) is used to maintain current and historical versions of files such as source code, web pages, and documentation. Its goal is to be a mostly-compatible successor to the widely used Concurrent Versions System (CVS).

It is very easy to install subversion client on linux OS using yum. You can us following command to install subversion client.

root@server [~]# yum install subversion

Source: http://linuxwindowsmaster.com/how-to-install-subversion-client-on-linux-server/

Posted in svn

Ignore Files and Directories in Subversion

# ---------------------------------------------------------------------
#  Ignore all the .txt files in the /trunk/Blah/ directory
# ---------------------------------------------------------------------
 
# Go to the directory
cd trunk/Blah/              # The directory with the files
 
# Start editing the properties for the current directory
svn propedit svn:ignore .   # Opens an editor (SVN_EDITOR, EDITOR)
 
# Add the following value with a new line, save, and exit:
*.txt
 
# See that things worked
svn propget svn:ignore .    # So you can see the properties
svn status --no-ignore      # You should see an 'I' next to the ignored files
 
# Commit
svn commit -m "New Ignores" # You must commit the new property change
 
# ---------------------------------------------------------------------
#     Ignore a single file secret.txt in the /trunk/ directory
# ---------------------------------------------------------------------
 
# Go to the directory
cd trunk/
 
# Add just the single file to the current directories ignore list (like above)
# Note the dot at the end of the command is important
svn propset svn:ignore secret.txt .
 
# See that things worked
svn propget svn:ignore .    # Notice the single file was added to the list
svn status --no-ignore      # You should see an 'I' next to the ignored files
 
# Commit
svn commit -m "Its secret"  # You must commit the new property change

Source: http://blog.bogojoker.com/2008/07/command-line-svnignore-a-file/

Posted in svn

Setup svn repo with an auto update hook

This is on a MediaTemple VPS running on CentOS 5 and is assuming you already have svn installed

So first thing is to go into the hooks folder for a particluar svn repository

cd /var/svn/website/hooks

You’ll see they all have .tmpl on the end – so the’yre all just templates

To make it active we need to remove the .tmpl
The one we want is post-commit.tmpl
So jut need to copy it to new file without the extension

cp post-commit.tmpl post-commit

So now we need to vi into it
You’ll see its full or instructions, etc.
You can just leave that
Go down to bottom
Comment out the last 5 lines, well last 2 and the 2 above

Now add two lines whever u want:

cd /var/www/vhosts/somedomain.com/subdomains/devdomain/httpdocs/  #path to website
svn up

Ok save and exit

Ok now need to make executable

chmod 755 post-committ

Now, the script needs to be owned by a user that has an svn account set up in the repo

To see list of users look in the passwd file ( /var/svn/website/conf/ )

chown username post-commit

Now u can test with

./post-commit

It might need the ownership of whoever made the working copy checkout on the server, the ones I have done I have always made the first checkout on the server so it’s always been my account.  It will give an error if it needs to be a different user ownership anyway.

Posted in svn