diff options
author | Geoff Berry <gberry@codeaurora.org> | 2016-01-19 17:36:02 +0000 |
---|---|---|
committer | Geoff Berry <gberry@codeaurora.org> | 2016-01-19 17:36:02 +0000 |
commit | 73c7b058de8838fcecbbda12dabc87edcaec5678 (patch) | |
tree | 0d5d52529b9665a50ffc86f49b42213800342f54 /cmake | |
parent | a27a3f756ce9ce1e8e7ca30395f02b5eeccdbe21 (diff) |
[cmake] Fix add_version_info_from_vcs git svn version bug.
Summary:
add_version_info_from_vcs was setting SVN_REVISION to the last fetched
svn revision when using git svn instead of the svn revision
corresponding to HEAD. This leads to conflicts with the definition of
SVN_REVISION in SVNVersion.inc generated by GetSVN.cmake when HEAD is
not the most recently fetched svn revision.
Use 'git svn info' to determine SVN_REVISION when git svn is being used
instead (as is done in GetSVN.cmake).
Reviewers: beanz
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D16299
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258148 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/modules/VersionFromVCS.cmake | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/cmake/modules/VersionFromVCS.cmake b/cmake/modules/VersionFromVCS.cmake index 85cb8ead21a..6be4daa3166 100644 --- a/cmake/modules/VersionFromVCS.cmake +++ b/cmake/modules/VersionFromVCS.cmake @@ -27,16 +27,20 @@ function(add_version_info_from_vcs VERS) find_program(git_executable NAMES git git.exe git.cmd) if( git_executable ) set(is_git_svn_rev_exact false) - execute_process(COMMAND ${git_executable} svn log --limit=1 --oneline + execute_process(COMMAND + ${git_executable} svn info WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} TIMEOUT 5 RESULT_VARIABLE git_result OUTPUT_VARIABLE git_output) if( git_result EQUAL 0 ) - string(REGEX MATCH r[0-9]+ git_svn_rev ${git_output}) - string(LENGTH "${git_svn_rev}" rev_length) - math(EXPR rev_length "${rev_length}-1") - string(SUBSTRING "${git_svn_rev}" 1 ${rev_length} git_svn_rev_number) + string(REGEX MATCH "URL: ([^ \n]*)" svn_url ${git_output}) + if(svn_url) + set(LLVM_REPOSITORY ${CMAKE_MATCH_1} PARENT_SCOPE) + endif() + + string(REGEX REPLACE "^(.*\n)?Revision: ([^\n]+).*" + "\\2" git_svn_rev_number "${git_output}") set(SVN_REVISION ${git_svn_rev_number} PARENT_SCOPE) set(git_svn_rev "-svn-${git_svn_rev}") @@ -69,18 +73,6 @@ function(add_version_info_from_vcs VERS) set(result "${result}${git_svn_rev}") endif() - execute_process(COMMAND - ${git_executable} svn info - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - TIMEOUT 5 - RESULT_VARIABLE git_result - OUTPUT_VARIABLE git_output) - if( git_result EQUAL 0) - string(REGEX MATCH "URL: ([^ \n]*)" svn_url ${git_output}) - if(svn_url) - set(LLVM_REPOSITORY ${CMAKE_MATCH_1} PARENT_SCOPE) - endif() - endif() endif() endif() endif() |