Fixed: Problem while parsing hg command line with a german locale

This commit is contained in:
kervala 2012-11-04 17:10:26 +01:00
parent 92e520eb92
commit affc4937c0

View file

@ -60,7 +60,7 @@ IF(Mercurial_HG_EXECUTABLE)
"\\1" Mercurial_VERSION_HG "${Mercurial_VERSION_HG}") "\\1" Mercurial_VERSION_HG "${Mercurial_VERSION_HG}")
MACRO(Mercurial_WC_INFO dir prefix) MACRO(Mercurial_WC_INFO dir prefix)
EXECUTE_PROCESS(COMMAND ${Mercurial_HG_EXECUTABLE} tip EXECUTE_PROCESS(COMMAND ${Mercurial_HG_EXECUTABLE} tip --template "{rev};{node};{tags};{author}"
WORKING_DIRECTORY ${dir} WORKING_DIRECTORY ${dir}
OUTPUT_VARIABLE ${prefix}_WC_INFO OUTPUT_VARIABLE ${prefix}_WC_INFO
ERROR_VARIABLE Mercurial_hg_info_error ERROR_VARIABLE Mercurial_hg_info_error
@ -70,18 +70,18 @@ IF(Mercurial_HG_EXECUTABLE)
IF(NOT ${Mercurial_hg_info_result} EQUAL 0) IF(NOT ${Mercurial_hg_info_result} EQUAL 0)
MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} tip\" failed with output:\n${Mercurial_hg_info_error}") MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} tip\" failed with output:\n${Mercurial_hg_info_error}")
ELSE(NOT ${Mercurial_hg_info_result} EQUAL 0) ELSE(NOT ${Mercurial_hg_info_result} EQUAL 0)
LIST(LENGTH ${prefix}_WC_INFO _COUNT)
STRING(REGEX REPLACE "^(.*\n)?Repository Root: ([^\n]+).*" IF(_COUNT EQUAL 4)
"\\2" ${prefix}_WC_ROOT "${${prefix}_WC_INFO}") LIST(GET ${prefix}_WC_INFO 0 ${prefix}_WC_REVISION)
STRING(REGEX REPLACE "^(.*\n)?changeset: *([0-9]+).*" LIST(GET ${prefix}_WC_INFO 1 ${prefix}_WC_CHANGESET)
"\\2" ${prefix}_WC_REVISION "${${prefix}_WC_INFO}") LIST(GET ${prefix}_WC_INFO 2 ${prefix}_WC_BRANCH)
STRING(REGEX REPLACE "^(.*\n)?Last Changed Author: ([^\n]+).*" LIST(GET ${prefix}_WC_INFO 3 ${prefix}_WC_LAST_CHANGED_AUTHOR)
"\\2" ${prefix}_WC_LAST_CHANGED_AUTHOR "${${prefix}_WC_INFO}") ELSE(_COUNT EQUAL 4)
STRING(REGEX REPLACE "^(.*\n)?Last Changed Rev: ([^\n]+).*" MESSAGE(STATUS "Bad output from HG")
"\\2" ${prefix}_WC_LAST_CHANGED_REV "${${prefix}_WC_INFO}") SET(${prefix}_WC_REVISION "unknown")
STRING(REGEX REPLACE "^(.*\n)?Last Changed Date: ([^\n]+).*" SET(${prefix}_WC_CHANGESET "unknown")
"\\2" ${prefix}_WC_LAST_CHANGED_DATE "${${prefix}_WC_INFO}") SET(${prefix}_WC_BRANCH "unknown")
ENDIF(_COUNT EQUAL 4)
ENDIF(NOT ${Mercurial_hg_info_result} EQUAL 0) ENDIF(NOT ${Mercurial_hg_info_result} EQUAL 0)
ENDMACRO(Mercurial_WC_INFO) ENDMACRO(Mercurial_WC_INFO)