[PATCH] D30092: CMake: Clean up VersionFromVCS.cmake
Chris Bieneman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 17 15:19:15 PST 2017
beanz added a comment.
Mostly looks good, a few inline comments below.
================
Comment at: cmake/modules/VersionFromVCS.cmake:37
execute_process(COMMAND
- ${git_executable} svn info
+ ${git_executable} svn info --url
WORKING_DIRECTORY ${SOURCE_DIR}
----------------
If the git svn information hasn't been updated recently the output of this command will also contain the log of rebuilding the git-svn data. Maybe run `git svn fetch` first to rebuild. Then when you run `git svn info --url` the only output should be the url.
================
Comment at: cmake/modules/VersionFromVCS.cmake:43
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()
-
- 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}")
-
- # Determine if the HEAD points directly at a subversion revision.
- execute_process(COMMAND ${git_executable} svn find-rev HEAD
- WORKING_DIRECTORY ${SOURCE_DIR}
- TIMEOUT 5
- RESULT_VARIABLE git_result
- OUTPUT_VARIABLE git_output)
- if( git_result EQUAL 0 )
- string(STRIP "${git_output}" git_head_svn_rev_number)
- if( git_head_svn_rev_number EQUAL git_svn_rev_number )
- set(is_git_svn_rev_exact true)
- endif()
- endif()
- else()
- set(git_svn_rev "")
+ string(STRIP "${git_output}" svn_url)
+ set(LLVM_REPOSITORY ${svn_url} PARENT_SCOPE)
----------------
Instead of doing this strip you could add `OUTPUT_STRIP_TRAILING_WHITESPACE` to the `execute_process` call. The same applies to the other places we call `string(STRIP...)`
https://reviews.llvm.org/D30092
More information about the llvm-commits
mailing list