Featured Post

Cherokee vs Apache : An alternative web server

As I have been developing for the web for over a decade, I have become comfortable with tools and technologies which have helped me get the job done. Some of these technologies I have seen evolve and progress into what are now essential and very powerful solutions. I have established an affinity with...

Read More

Upgrading SVN on Linux (CentOS)

Posted by Craig_Strong | Posted in Subversion | Posted on 09-07-2009

Tags: , , , , , , , , ,

3

The following series of events were carried out on CentOS 5 and were a success. If you are using a RedHat based systems such as CentOS or Fedora, the following series of instructions should allow you to upgrade svn in the same way.

Please note you must investigate your own server settings and in no way should you make any changes to your systems suggested here unless you are 100% confident that these changes will not result in problems to your system.

Recently I ran into a problem when using TortoiseSVN and the command line on CentOS. It appeared that after upgrading my version of tortoise I was being presented with errors on the command line when trying to run simple svn commands. Further investigation revealed that I was using an older version of svn on my server which was resulting in conflicts between my server and tortoise when quering the same repository. So I decided to record the procedure I went through to upgrade my version of svn and share it here. The most recent version of svn was which was 1.6 at the time of writing.

  1. Run ‘svn –version’ on the command line to confirm that you running an older version of svn than 1.6. In my case his revealed : ‘svn, version 1.4.6′. Upgrade needed.
  2. Check that YUM doesn’t have the version you require using the by running ‘YUM upgrade subversion’. In my case I received the response ‘No Packages marked for Update’.
  3. Make sure you have priorities installed by running ‘YUM install yum-priorities’
  4. Ensure that the priorities plugin is enabled by editing : ‘/etc/yum/plugincont.d/priorities.conf’. Then set ‘[main] enabled = 1′.
  5. Edit the .repo files in ‘/etc/yum.repos.d/*’ by adding ‘priority=N’ where N is 1 to 99 depending on your system.
  6. Priorities that I used :

    • Base, add-ons, updates, extras = 1
    • CentOS plus, contrib = 2
    • 3rd party repos such as RPMForge = N (Where N >=10)
  7. Download the RPM release package from : ‘http://apt.sw.be/redhat/el5/en/x86_64/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
  8. Install DAGS GPG Key ‘rpm –import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
  9. Verify the package download by running ‘rpm -K rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
  10. If the package is verified, install the package ‘rpm -i rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
  11. Test that the package installed by running ‘yum check-update’. Look for ‘loading priority plugin’ and ‘excluded packages’ due to the priorities plugin being present.
  12. Add the following to the [base] and [update] sections of the centos.repo files in /etc/yum.repos.d/ (You may wish to add this to other 3rd party files in this directory as well):
      ‘exclude=subversion’.
  13. Now yum will behave as if there’s no package named subversion in the core repositories and will install the latest ’1.6′ from RpmForge.
  14. Run ‘yum install subversion’ and you should now see the latest subversion being installed. After which you can run ‘svn –version’ just to be sure.

Now you should have the latest version of subversion on your system.

Common svn commands using the command line

Posted by Craig_Strong | Posted in Subversion | Posted on 28-03-2009

Tags: , , , , , , , , , , ,

2

Over the past few months I have been switching between operating systems which have included, Cent OS, Fedora, Vista and Mac OS X. When switching through these operating systems I am very aware of cross compatibility when using OS dependent software. Other than the obvious differences which include such things as file systems, one thing I have been quite frustrated with is interacting with SVN whilst moving between these operating systems. Why this has been frustrating it’s because for each of the OS’s above there is dependent software such as Tortoise SVN on windows. This is a great SVN tool and really does make things easier. However this is a Windows SVN tool so I can’t use it on other OS’s. Although there are tools available on other OS’s, I don’t want to keep switching between OS specific software as it can be time consuming and takes you a step further away from the source/task.  

Why use the command line ?

As a result of the restrictions imposed when moving around different OS’s, I have reverted my svn interaction back to the beloved command line for most svn tasks. Now I know some of you reading this may see this as a step backward in the world of modern UI, but there are a few good reasons why I have made this decision:

  1. With the exception of running putty on Windows to interact with my svn repository which sits on Linux, the command line makes you closer to being OS independent when it comes to svn.
  2.  

  3. Running svn commands on the command line is much quicker as it doesn’t have to go through the rendering process or additional layers of the OS or a series of extensive third party code. There is much less clutter, it’s just plain and simple (WYSIWYG).
  4.  

  5. I have had problems with the OS network cache, such as when ‘subclipse‘ or ‘Tortoise‘ tell you that you are working within a branch when you are actually on the trunk! As you can imagine, this can have problematic knock on effects and this is where the command line doesn’t lie. You don’t need to click refresh on your working copy directory to get the truth, you simple ask it once and it tells you there and then, no caching involved.
  6.  

  7. You don’t have to learn how to use each OS’s svn tool’s navigational menus and can therefore spend the time learning the commands plain and simple, saving you time in the long run.

 
Now I’m not saying that UI svn clients don’t have a value, the visual advantages can be extremely significant, especially when merging and looking at diff’s etc. You might find yourself going back now and again to use these tools for these advantages alone. The point is for general usage the command line has a significant value for me and for general svn interaction entering simple commands can be a time saver.

Everyday SVN Commands

For  those who are interested and for an online resource I can frequent to compensate for my poor memory, I have listed a few of the common commands I use on a day to day basis below:

Note: For the purpose of these commands I will express the path the repository as $REPO

 

svn log –revision 55:90  

Shows the log history from revision 55 to revision 99

_____________________

svn log -r 66:44

Shows the log history from revision 66 to revision 44 in reverse order

_____________________

svn log -r 81

Shows the log specifically for the chosen revision 81

_____________________

svn log $REPO/branch1234

Shows the log history for a specific branch

_____________________

svn log -vr 1234

Shows the modifications for a particular revision

_____________________

svn log –stop-on-copy | grep-i “update”

This will show the commit history up until it finds the phrase ‘update’ in the commit log

_____________________

svn list $REPO/branches/branch-123

lists the directories/files within the selected branch-123

_____________________

svn switch $REPO/branch/branch123/siteA

If you are in your working copy site directory, this command will switch your current location to the branch you require. For example if you are in my/working/copy/siteA which is checked out to the trunk, this command with switch you over to your selected branch. Note : You can also enter this command as “svn switch $REPO/branch/branch123/siteA /path/to/your/siteA”.

_____________________

svn mkdir $REPO/branches/branch333

Creates a new directory within the repository. Within my example I have created a new branch.

_____________________

svn cp $REPO/trunk/siteA $REPO/branches/branch456/siteA

Checks out the site ‘siteA’ to a selected branch ‘branch456′.

_____________________

svn diff –summarize –old=$REPO/trunk/site –new = $REPO/branches/branch333/siteA

Shows the list of files that are different between the two versions selected.

_____________________

svn merge –dry-run -r123:200 $REPO/trunk/siteA

carries out a dry run of a merge between the head of branch ‘r123′ and the head of trunk ’200′. (A merge can be between any two revision numbers)

_____________________

svn commit -m “A brief, but informative message here”

This will commit any changes to your trunk/branch accordingly and record a message in the commit log. Remember you will be reading these log messages often. If you are working within a team ask yourself if someone else looked at the commit log could they work out what your commit involved from your message. Although sometimes seen as a repetitive task entering messages, these are there for a reason. It might be good practice to employ a message standard within your workplace to keep messages consistent.

_____________________


svn info /path/to/site/in/workingcopy

This will output the information for the file/directory within your working copy. You can know exactly where your working and the current status from this. Example :

craig-strongs:~ craigstrong$ svn info ~craigstrong/working_copy/

Path: /Users/craigstrong/working_copy/

URL: svn+ssh://craig@repo/my/path

Repository Root: svn+ssh://craig@repo/my/path

Repository UUID: 12345-12345-12345-12345

Revision: 875533

Node Kind: directory

Schedule: normal

Last Changed Author: craig

Last Changed Rev: 875533

Last Changed Date: 2009-03-25 16:46:59 +0000 (Wed, 25 Mar 2009)

_____________________

svn status /path/to/working_copy

This will list the current status of your working copy. If you have switched any files/directories, you should be seeing these listed within the results back. Other information such as if you have any uncommitted files will also be listed here.

_____________________

I’ll restrict the list to the above for now as these are what I consider to be the most common commands that I use on a day to day basis. If I find myself often writing other such commands regularly I’ll add them to the above.  If you feel you would like to add to this list, please feel free to reply to this post.