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

BUG: detect the type of repository (hg/git)

parent 0630f094
No related branches found
No related tags found
No related merge requests found
if(EXISTS "${PROJECT_SOURCE_DIR}/.hg")
find_package(Mercurial)
if(Mercurial_FOUND)
message(STATUS "Repository status :")
......@@ -24,3 +25,27 @@ if(Mercurial_FOUND)
endif()
endif()
endif()
if(EXISTS "${PROJECT_SOURCE_DIR}/.git")
find_package(Git)
if(GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --pretty=oneline
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE OTB_WC_VERSION
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}")
if(OTB_WC_STATUS)
message(STATUS " Local file modifications:")
string(REPLACE "\n" "\n-- " OTB_WC_STATUS_PRETTYPRINT " ${OTB_WC_STATUS}")
message(STATUS "${OTB_WC_STATUS_PRETTYPRINT}")
else()
message(STATUS " No files modified locally")
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