Using URL’s in svn log command

I do next to no Shell programming but today I was asked to overcome for the lacking svn log which only works when revision numbers are used.

svn log --xml -r 2100:2200

The above would return the change log between the revision numbers in XML format. I wanted something which would return the difference between two branches or tags (URL’s). Something which could be used like the following:

svnurllog --xml tag1 tag2

Although nothing like that exists, the svn info command can help.

The output of the svn info svn+ssh:// command on a URL is something like:

Path: .
URL: svn+ssh://
Repository Root: svn+ssh://
Repository UUID: 8fa5a7e2-1820-0410-828f-e763003672c7
Revision: 6580
Node Kind: directory

Given a URL, we need to map it to a revision number so it can be passed to the svn log command to generate the change log. Hence we’re interested in the fourth line to parse out the revision number.

Here’s a script called svnurllog that does just that and then calls svn log once its retrieved. The usage for it is:

svnurllog tag1 tag2 > changelog.xml

# svnurllog

if [ -z $2 ]; then
echo "Usage: svnurllog url1 url2"



#echo "Creating change log between $url1 and $url2"
url1_info=$(svn info $url1 | awk '/Last Changed Rev/{print $4}')
url2_info=$(svn info $url2 | awk '/Last Changed Rev/{print $4}')
#echo "Executing svn log --xml -r$url1_info:$url2_info"
svn log --xml --verbose -r$url2_info:$url1_info

Leave a Reply

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

You are commenting using your 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 )


Connecting to %s