mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-22 04:11:16 -05:00
Fix svn revision detection that I broke when adding git-svn support.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3958 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
52f5d4c7ff
commit
7db318ae49
@ -18,35 +18,35 @@ if (Subversion_FOUND AND EXISTS "${SOURCE_DIR}/.svn")
|
||||
message (STATUS "${__svn_change}")
|
||||
endforeach (__svn_change ${__svn_changes})
|
||||
endif (__svn_changes)
|
||||
message (STATUS "${SOURCE_DIR} contains a .svn and is revision ${MY_WC_REVISION}")
|
||||
# write a file with the SVNVERSION define
|
||||
file (WRITE svnversion.h.txt "#define SVNVERSION r${MY_WC_REVISION}\n")
|
||||
file (WRITE "${OUTPUT_DIR}/svnversion.h.txt" "#define SVNVERSION r${MY_WC_REVISION}\n")
|
||||
else (Subversion_FOUND AND EXISTS "${SOURCE_DIR}/.svn")
|
||||
file (WRITE svnversion.h.txt "#define SVNVERSION local\n")
|
||||
endif ()
|
||||
|
||||
if (Subversion_FOUND AND EXISTS "${SOURCE_DIR}/.git")
|
||||
# the FindSubversion.cmake module is part of the standard distribution
|
||||
include (${SOURCE_DIR}/CMake/Modules/FindGitSubversion.cmake)
|
||||
# extract working copy information for SOURCE_DIR into MY_XXX variables
|
||||
GitSubversion_WC_INFO (${SOURCE_DIR} MY)
|
||||
message ("${MY_WC_INFO}")
|
||||
# try and determine if the working copy has outstanding changes
|
||||
execute_process (COMMAND ${GIT_EXECUTABLE} --git-dir=${SOURCE_DIR}/.git --work-tree=${SOURCE_DIR} svn dcommit --dry-run
|
||||
RESULT_VARIABLE __git_svn_status
|
||||
OUTPUT_FILE "${OUTPUT_DIR}/svn_status.txt"
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
file (STRINGS "${OUTPUT_DIR}/svn_status.txt" __svn_changes
|
||||
REGEX "^diff-tree"
|
||||
)
|
||||
if ((NOT ${__git_svn_status} EQUAL 0) OR __svn_changes)
|
||||
set (MY_WC_REVISION "${MY_WC_REVISION}-dirty")
|
||||
endif ()
|
||||
# write a file with the SVNVERSION define
|
||||
file (WRITE svnversion.h.txt "#define SVNVERSION r${MY_WC_REVISION}\n")
|
||||
else (Subversion_FOUND AND EXISTS "${SOURCE_DIR}/.svn")
|
||||
file (WRITE svnversion.h.txt "#define SVNVERSION local\n")
|
||||
endif ()
|
||||
# try git-svn
|
||||
if (Subversion_FOUND AND EXISTS "${SOURCE_DIR}/.git")
|
||||
# the FindSubversion.cmake module is part of the standard distribution
|
||||
include (${SOURCE_DIR}/CMake/Modules/FindGitSubversion.cmake)
|
||||
# extract working copy information for SOURCE_DIR into MY_XXX variables
|
||||
GitSubversion_WC_INFO (${SOURCE_DIR} MY)
|
||||
message ("${MY_WC_INFO}")
|
||||
# try and determine if the working copy has outstanding changes
|
||||
execute_process (COMMAND ${GIT_EXECUTABLE} --git-dir=${SOURCE_DIR}/.git --work-tree=${SOURCE_DIR} svn dcommit --dry-run
|
||||
RESULT_VARIABLE __git_svn_status
|
||||
OUTPUT_FILE "${OUTPUT_DIR}/svn_status.txt"
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
file (STRINGS "${OUTPUT_DIR}/svn_status.txt" __svn_changes
|
||||
REGEX "^diff-tree"
|
||||
)
|
||||
if ((NOT ${__git_svn_status} EQUAL 0) OR __svn_changes)
|
||||
set (MY_WC_REVISION "${MY_WC_REVISION}-dirty")
|
||||
endif ()
|
||||
# write a file with the SVNVERSION define
|
||||
file (WRITE "${OUTPUT_DIR}/svnversion.h.txt" "#define SVNVERSION r${MY_WC_REVISION}\n")
|
||||
else (Subversion_FOUND AND EXISTS "${SOURCE_DIR}/.svn")
|
||||
file (WRITE "${OUTPUT_DIR}/svnversion.h.txt" "#define SVNVERSION local\n")
|
||||
endif (Subversion_FOUND AND EXISTS "${SOURCE_DIR}/.git")
|
||||
endif (Subversion_FOUND AND EXISTS "${SOURCE_DIR}/.svn")
|
||||
|
||||
# copy the file to the final header only if the version changes
|
||||
# reduces needless rebuilds
|
||||
execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different svnversion.h.txt svnversion.h)
|
||||
execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different "${OUTPUT_DIR}/svnversion.h.txt" "${OUTPUT_DIR}/svnversion.h")
|
||||
|
Loading…
Reference in New Issue
Block a user