BUG: Fixes for FindSubversion

- Split log out from Subversion_WC_INFO into Subversion_WC_LOG
  - Fix report of log info to be in <var-prefix>_WC_LAST_CHANGED_LOG
    as documented (instead of Subversion_LAST_CHANGED_LOG)
  - Fix setting of LC_ALL environment variable to be inside macro
  - Patch from Tanguy Krotoff
  - See issue #7047
This commit is contained in:
Brad King 2008-05-19 10:03:59 -04:00
parent 2783b537cd
commit e0b26f4aea
1 changed files with 19 additions and 10 deletions

View File

@ -20,6 +20,8 @@
# IF(Subversion_FOUND)
# Subversion_WC_INFO(${PROJECT_SOURCE_DIR} Project)
# MESSAGE("Current revision is ${Project_WC_REVISION}")
# Subversion_WC_LOG(${PROJECT_SOURCE_DIR} Project)
# MESSAGE("Last changed log is ${Project_LAST_CHANGED_LOG}")
# ENDIF(Subversion_FOUND)
# Copyright (c) 2006, Tristan Carel
@ -52,11 +54,6 @@
SET(Subversion_FOUND FALSE)
SET(Subversion_SVN_FOUND FALSE)
# the subversion commands should be executed with the C locale, otherwise
# the message (which are parsed) may be translated, Alex
SET(_Subversion_SAVED_LC_ALL "$ENV{LC_ALL}" )
SET(ENV{LC_ALL} C)
FIND_PROGRAM(Subversion_SVN_EXECUTABLE svn
DOC "subversion command line client")
MARK_AS_ADVANCED(Subversion_SVN_EXECUTABLE)
@ -66,6 +63,11 @@ IF(Subversion_SVN_EXECUTABLE)
SET(Subversion_FOUND TRUE)
MACRO(Subversion_WC_INFO dir prefix)
# the subversion commands should be executed with the C locale, otherwise
# the message (which are parsed) may be translated, Alex
SET(_Subversion_SAVED_LC_ALL "$ENV{LC_ALL}")
SET(ENV{LC_ALL} C)
EXECUTE_PROCESS(COMMAND ${Subversion_SVN_EXECUTABLE} --version
WORKING_DIRECTORY ${dir}
OUTPUT_VARIABLE Subversion_VERSION_SVN
@ -96,9 +98,19 @@ IF(Subversion_SVN_EXECUTABLE)
ENDIF(NOT ${Subversion_svn_info_result} EQUAL 0)
# restore the previous LC_ALL
SET(ENV{LC_ALL} ${_Subversion_SAVED_LC_ALL})
ENDMACRO(Subversion_WC_INFO)
MACRO(Subversion_WC_LOG dir prefix)
# This macro can block if the certificate is not signed:
# svn ask you to accept the certificate and wait for your answer
# This macro requires a svn server network access (Internet most of the time)
# and can also be slow since it access the svn server
EXECUTE_PROCESS(COMMAND
${Subversion_SVN_EXECUTABLE} log -r BASE ${dir}
OUTPUT_VARIABLE Subversion_LAST_CHANGED_LOG
OUTPUT_VARIABLE ${prefix}_LAST_CHANGED_LOG
ERROR_VARIABLE Subversion_svn_log_error
RESULT_VARIABLE Subversion_svn_log_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
@ -106,13 +118,10 @@ IF(Subversion_SVN_EXECUTABLE)
IF(NOT ${Subversion_svn_log_result} EQUAL 0)
MESSAGE(SEND_ERROR "Command \"${Subversion_SVN_EXECUTABLE} log -r BASE ${dir}\" failed with output:\n${Subversion_svn_log_error}")
ENDIF(NOT ${Subversion_svn_log_result} EQUAL 0)
ENDMACRO(Subversion_WC_INFO)
ENDMACRO(Subversion_WC_LOG)
ENDIF(Subversion_SVN_EXECUTABLE)
# restore the previous LC_ALL
SET(ENV{LC_ALL} ${_Subversion_SAVED_LC_ALL})
IF(NOT Subversion_FOUND)
IF(NOT Subversion_FIND_QUIETLY)
MESSAGE(STATUS "Subversion was not found.")