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