views:

291

answers:

3

Trying to make a makefile rule to check that svnversion gave a proper result.

Normally, it should return something like one of the following:

1023:1055M
1056

However, it can get an error like:

svn: This client is too old to work with working copy '.'; please get a newer Subversion client

So here is my version of the rule based on other posts:

test2:
    @if [ $$(svnversion | sed s/[0-9:M]*//g | grep '.') -neq ""]; \
    then        \
          echo >&2 "Unexpected result from 'svnversion'"  \
            "of $$(svnversion)";    \
          false;       \
    fi

However, the condition seems to trigger on both cases.

+1  A: 

The error you see tells that the 'svnversion' command is from another minor Subversion version than the client you use to update your working copy.

E.g. This happens when you use a TortoiseSVN based on Subversion 1.6.6 with the Subversion 1.5.6 commandline client.

Bert Huijben
This is not what is being asked for in this question.
WilliamKF
A: 
@if ! $(subversion) | grep -qE "[0-9]+:[0-9]+M"; then
SiegeX
This doesn't work for me.
WilliamKF
Note that svnversion can also use S and P in its result, or any combination of these letters.
Bert Huijben
A: 

Here is how I eventually resolved this:

test_svnversion_output:
    @if [ $$(svnversion 2>&- | wc | awk '{print $$1}') -eq 0 ]; \
    then        \
     echo >&2 "Error: 'svnversion' produced bad result" \
       "'$$(svnversion 2>&1)'.";   \
     false;       \
    fi
WilliamKF