diff options
author | Tom Stellard <tstellar@redhat.com> | 2019-10-31 13:39:48 -0700 |
---|---|---|
committer | Tom Stellard <tstellar@redhat.com> | 2019-11-08 09:59:42 -0800 |
commit | caad2170aed76d1df8b4305b1b7d81c4943626db (patch) | |
tree | 435088bd89f4320baa4f0202f4c1c8ac218fa9bc /llvm/cmake/modules | |
parent | 71f4761431a79794b5be24c1d863bcc0c4577e60 (diff) | |
download | bcm5719-llvm-caad2170aed76d1df8b4305b1b7d81c4943626db.tar.gz bcm5719-llvm-caad2170aed76d1df8b4305b1b7d81c4943626db.zip |
[cmake] Remove SVN support from VersionFromVCS.cmake
Reviewers: phosek
Subscribers: mgorny, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69682
Diffstat (limited to 'llvm/cmake/modules')
-rw-r--r-- | llvm/cmake/modules/VersionFromVCS.cmake | 103 |
1 files changed, 29 insertions, 74 deletions
diff --git a/llvm/cmake/modules/VersionFromVCS.cmake b/llvm/cmake/modules/VersionFromVCS.cmake index 56331a3a81f..1b6519b4b7c 100644 --- a/llvm/cmake/modules/VersionFromVCS.cmake +++ b/llvm/cmake/modules/VersionFromVCS.cmake @@ -3,27 +3,7 @@ # existence of certain subdirectories under SOURCE_DIR (if provided as an # extra argument, otherwise uses CMAKE_CURRENT_SOURCE_DIR). -function(get_source_info_svn path revision repository) - # If svn is a bat file, find_program(Subversion) doesn't find it. - # Explicitly search for that here; Subversion_SVN_EXECUTABLE will override - # the find_program call in FindSubversion.cmake. - find_program(Subversion_SVN_EXECUTABLE NAMES svn svn.bat) - find_package(Subversion) - - # Subversion module does not work with symlinks, see PR8437. - get_filename_component(realpath ${path} REALPATH) - if(Subversion_FOUND) - subversion_wc_info(${realpath} Project) - if(Project_WC_REVISION) - set(${revision} ${Project_WC_REVISION} PARENT_SCOPE) - endif() - if(Project_WC_URL) - set(${repository} ${Project_WC_URL} PARENT_SCOPE) - endif() - endif() -endfunction() - -function(get_source_info_git path revision repository) +function(get_source_info path revision repository) find_package(Git) if(GIT_FOUND) execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --git-dir @@ -34,61 +14,36 @@ function(get_source_info_git path revision repository) if(git_result EQUAL 0) string(STRIP "${git_output}" git_output) get_filename_component(git_dir ${git_output} ABSOLUTE BASE_DIR ${path}) - if(EXISTS "${git_dir}/svn/refs") - execute_process(COMMAND ${GIT_EXECUTABLE} svn info - WORKING_DIRECTORY ${path} - RESULT_VARIABLE git_result - OUTPUT_VARIABLE git_output) - if(git_result EQUAL 0) - string(REGEX REPLACE "^(.*\n)?Revision: ([^\n]+).*" - "\\2" git_svn_rev "${git_output}") - set(${revision} ${git_svn_rev} PARENT_SCOPE) - string(REGEX REPLACE "^(.*\n)?URL: ([^\n]+).*" - "\\2" git_url "${git_output}") - set(${repository} ${git_url} PARENT_SCOPE) - endif() + execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD + WORKING_DIRECTORY ${path} + RESULT_VARIABLE git_result + OUTPUT_VARIABLE git_output) + if(git_result EQUAL 0) + string(STRIP "${git_output}" git_output) + set(${revision} ${git_output} PARENT_SCOPE) + endif() + execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref --symbolic-full-name @{upstream} + WORKING_DIRECTORY ${path} + RESULT_VARIABLE git_result + OUTPUT_VARIABLE git_output + ERROR_QUIET) + if(git_result EQUAL 0) + string(REPLACE "/" ";" branch ${git_output}) + list(GET branch 0 remote) + else() + set(remote "origin") + endif() + execute_process(COMMAND ${GIT_EXECUTABLE} remote get-url ${remote} + WORKING_DIRECTORY ${path} + RESULT_VARIABLE git_result + OUTPUT_VARIABLE git_output + ERROR_QUIET) + if(git_result EQUAL 0) + string(STRIP "${git_output}" git_output) + set(${repository} ${git_output} PARENT_SCOPE) else() - execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD - WORKING_DIRECTORY ${path} - RESULT_VARIABLE git_result - OUTPUT_VARIABLE git_output) - if(git_result EQUAL 0) - string(STRIP "${git_output}" git_output) - set(${revision} ${git_output} PARENT_SCOPE) - endif() - execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref --symbolic-full-name @{upstream} - WORKING_DIRECTORY ${path} - RESULT_VARIABLE git_result - OUTPUT_VARIABLE git_output - ERROR_QUIET) - if(git_result EQUAL 0) - string(REPLACE "/" ";" branch ${git_output}) - list(GET branch 0 remote) - else() - set(remote "origin") - endif() - execute_process(COMMAND ${GIT_EXECUTABLE} remote get-url ${remote} - WORKING_DIRECTORY ${path} - RESULT_VARIABLE git_result - OUTPUT_VARIABLE git_output - ERROR_QUIET) - if(git_result EQUAL 0) - string(STRIP "${git_output}" git_output) - set(${repository} ${git_output} PARENT_SCOPE) - else() - set(${repository} ${path} PARENT_SCOPE) - endif() + set(${repository} ${path} PARENT_SCOPE) endif() endif() endif() endfunction() - -function(get_source_info path revision repository) - if(EXISTS "${path}/.svn") - get_source_info_svn("${path}" revision_info repository_info) - else() - get_source_info_git("${path}" revision_info repository_info) - endif() - set(${repository} "${repository_info}" PARENT_SCOPE) - set(${revision} "${revision_info}" PARENT_SCOPE) -endfunction() |