From ff18f8f0ec9d182406db482caa6d48da4fbc9efc Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 4 Nov 2012 17:10:26 +0100 Subject: [PATCH] Fixed: Problem while parsing hg command line with a german locale --- code/CMakeModules/FindMercurial.cmake | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/code/CMakeModules/FindMercurial.cmake b/code/CMakeModules/FindMercurial.cmake index 9c252ad17..a18e50c43 100644 --- a/code/CMakeModules/FindMercurial.cmake +++ b/code/CMakeModules/FindMercurial.cmake @@ -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)