Skip to content
Snippets Groups Projects
Commit 74e0ed91 authored by Guillaume Pasero's avatar Guillaume Pasero
Browse files

BUG: parse correctly OTB-Data revision number

parent 7c130ac4
No related branches found
No related tags found
No related merge requests found
......@@ -17,29 +17,22 @@ if(Mercurial_FOUND)
string(REGEX REPLACE "\n" ";" OTB_WC_STATUS "${OTB_WC_STATUS}")
set(OTB_WC_STATUS ${OTB_WC_STATUS} CACHE STRING "Repository status" FORCE)
mark_as_advanced(OTB_WC_STATUS)
if(OTB_DATA_ROOT)
Mercurial_WC_IDENTIFY(${OTB_DATA_ROOT} OTB_DATA)
set(OTB_DATA_WC_REVISION ${OTB_DATA_WC_REVISION} CACHE STRING "Repository version" FORCE)
mark_as_advanced(OTB_DATA_WC_REVISION)
endif()
endif()
endif()
if(EXISTS "${PROJECT_SOURCE_DIR}/.git")
find_package(Git)
if(GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --pretty=oneline
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:%H
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE OTB_WC_VERSION
OUTPUT_VARIABLE OTB_WC_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
execute_process(COMMAND ${GIT_EXECUTABLE} status -s
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE OTB_WC_STATUS
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
message(STATUS "Repository status :")
message(STATUS " Repository revision is ${OTB_WC_VERSION}")
message(STATUS " Repository revision is ${OTB_WC_REVISION}")
if(OTB_WC_STATUS)
message(STATUS " Local file modifications:")
string(REPLACE "\n" "\n-- " OTB_WC_STATUS_PRETTYPRINT " ${OTB_WC_STATUS}")
......@@ -49,3 +42,30 @@ if(EXISTS "${PROJECT_SOURCE_DIR}/.git")
endif()
endif()
endif()
if(OTB_DATA_ROOT)
if(EXISTS "${OTB_DATA_ROOT}/.hg")
if(NOT Mercurial_FOUND)
find_package(Mercurial)
endif()
if(Mercurial_FOUND)
Mercurial_WC_IDENTIFY(${OTB_DATA_ROOT} OTB_DATA)
set(OTB_DATA_WC_REVISION ${OTB_DATA_WC_REVISION} CACHE STRING "Repository version" FORCE)
mark_as_advanced(OTB_DATA_WC_REVISION)
endif()
endif()
if(EXISTS "${OTB_DATA_ROOT}/.git")
if(NOT GIT_FOUND)
find_package(Git)
endif()
if(GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:%H
WORKING_DIRECTORY ${OTB_DATA_ROOT}
OUTPUT_VARIABLE OTB_DATA_WC_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
set(OTB_DATA_WC_REVISION ${OTB_DATA_WC_REVISION} CACHE STRING "Repository version" FORCE)
mark_as_advanced(OTB_DATA_WC_REVISION)
endif()
endif()
endif()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment