[Cmake-commits] CMake branch, next, updated. v2.8.1-1247-gcfb1b41

cmake-commits at cmake.org cmake-commits at cmake.org
Thu May 27 15:50:36 EDT 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  cfb1b413f7e67fead5574db0e86a5449d4c32a7e (commit)
       via  1dd316563a7bd7dc97aeb3f9632f232bf7267e57 (commit)
      from  48b295292216a1aa8161adf912834b5a1a9e9749 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cfb1b413f7e67fead5574db0e86a5449d4c32a7e
commit cfb1b413f7e67fead5574db0e86a5449d4c32a7e
Merge: 48b2952 1dd3165
Author: David Cole <david.cole at kitware.com>
Date:   Thu May 27 15:49:38 2010 -0400

    Merge branch 'add-git-to-CheckSourceTreeTest' into next


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1dd316563a7bd7dc97aeb3f9632f232bf7267e57
commit 1dd316563a7bd7dc97aeb3f9632f232bf7267e57
Author: David Cole <david.cole at kitware.com>
Date:   Thu May 27 14:38:53 2010 -0400

    Add git support to the CMake.CheckSourceTree test.
    
    Additionally, output some more information in both cvs
    and git cases. When it is a cvs checkout, echo the contents
    of CVS/Root and CVS/Repository to the test output. When it
    is a git checkout, echo the output of 'git branch -a'.
    
    This will allow us to see more details about any given CMake
    source tree right in the CDash results for this test.

diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt
index 7a176e9..cb8f2ba 100644
--- a/Tests/CMakeTests/CMakeLists.txt
+++ b/Tests/CMakeTests/CMakeLists.txt
@@ -46,13 +46,14 @@ AddCMakeTest(GetPrerequisites "${GetPrerequisites_PreArgs}")
 # suite. It detects if any changes have been made to the CMake source tree
 # by any previous configure, build or test steps.
 #
-if(do_cvs_tests)
+if(do_cvs_tests OR GIT_EXECUTABLE)
   string(REPLACE "\\" "/" ENV_HOME "$ENV{HOME}")
   set(CheckSourceTree_PreArgs
     "-DCMake_BINARY_DIR:PATH=${CMake_BINARY_DIR}"
     "-DCMake_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}"
     "-DCVS_EXECUTABLE:STRING=${CVS_EXECUTABLE}"
+    "-DGIT_EXECUTABLE:STRING=${GIT_EXECUTABLE}"
     "-DHOME:STRING=${ENV_HOME}"
     )
   AddCMakeTest(CheckSourceTree "${CheckSourceTree_PreArgs}")
-endif(do_cvs_tests)
+endif(do_cvs_tests OR GIT_EXECUTABLE)
diff --git a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in
index 1cfadcb..82207e4 100644
--- a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in
+++ b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in
@@ -6,6 +6,7 @@ message("")
 message("CMake_BINARY_DIR='${CMake_BINARY_DIR}'")
 message("CMake_SOURCE_DIR='${CMake_SOURCE_DIR}'")
 message("CVS_EXECUTABLE='${CVS_EXECUTABLE}'")
+message("GIT_EXECUTABLE='${GIT_EXECUTABLE}'")
 message("HOME='${HOME}'")
 message("ENV{DASHBOARD_TEST_FROM_CTEST}='$ENV{DASHBOARD_TEST_FROM_CTEST}'")
 message("")
@@ -42,55 +43,138 @@ message("in_source_build='${in_source_build}'")
 message("")
 
 
-# If this does not appear to be a CVS checkout, just pass the test here and now.
-# (Do not let the test fail if it is run in a tree *exported* from CVS or
-# unpacked from a .zip file source installer...)
+# If this does not appear to be a git or CVS checkout, just pass the test here
+# and now. (Do not let the test fail if it is run in a tree *exported* from a
+# repository or unpacked from a .zip file source installer...)
 #
-if(NOT EXISTS "${CMake_SOURCE_DIR}/CVS/Root")
-  message("source tree is not a CVS checkout... test passes by early return...")
-  return()
+set(is_git_checkout 0)
+if(EXISTS "${CMake_SOURCE_DIR}/.git")
+  set(is_git_checkout 1)
 endif()
 
+set(is_cvs_checkout 0)
+if(EXISTS "${CMake_SOURCE_DIR}/CVS/Root")
+  set(is_cvs_checkout 1)
+endif()
 
-# Check with "cvs -q -n up -dP" if there are any local modifications to the
-# CMake source tree:
-#
-message("=============================================================================")
-message("Copy/paste this command to reproduce:")
-message("cd \"${CMake_SOURCE_DIR}\" && \"${CVS_EXECUTABLE}\" -q -n up -dP")
+message("is_git_checkout='${is_git_checkout}'")
+message("is_cvs_checkout='${is_cvs_checkout}'")
 message("")
 
-# Use the HOME value passed in to the script for calling cvs so it can find
-# its .cvspass and other file(s)
-#
-set(original_ENV_HOME "$ENV{HOME}")
-set(ENV{HOME} "${HOME}")
-
-execute_process(COMMAND ${CVS_EXECUTABLE} -q -n up -dP
-  WORKING_DIRECTORY ${CMake_SOURCE_DIR}
-  OUTPUT_VARIABLE ov
-  ERROR_VARIABLE ev
-  RESULT_VARIABLE rv)
-
-set(ENV{HOME} "${original_ENV_HOME}")
-
-message("Results of running '${CVS_EXECUTABLE} -q -n up -dP'")
-message("rv='${rv}'")
-message("ov='${ov}'")
-message("ev='${ev}'")
-message("")
+if(NOT is_cvs_checkout)
+if(NOT is_git_checkout)
+  message("source tree is neither git nor CVS checkout... test passes by early return...")
+  return()
+endif()
+endif()
 
-if(NOT rv STREQUAL 0)
-  message(FATAL_ERROR "error: 'cvs -q -n up -dP' attempt failed... (see output above)")
+if(is_cvs_checkout)
+if(is_git_checkout)
+  message("warning: source tree has both git *and* CVS file system bits???")
+  # should this condition be a FATAL_ERROR test failure...?
+endif()
 endif()
 
-# Analyze cvs output:
+
+# This test looks for the following types of changes in the source tree:
 #
 set(additions 0)
 set(conflicts 0)
 set(modifications 0)
 set(nonadditions 0)
 
+# ov == output variable... conditionally filled in by either cvs or git below:
+#
+set(cmd "")
+set(ov "")
+set(ev "")
+set(rv "")
+
+
+if(is_cvs_checkout AND CVS_EXECUTABLE)
+  # Check with "cvs -q -n up -dP" if there are any local modifications to the
+  # CMake source tree:
+  #
+  message("=============================================================================")
+  message("This is a cvs checkout, using cvs to verify source tree....")
+  message("")
+
+  file(READ "${CMake_SOURCE_DIR}/CVS/Root" contents)
+  message("=== content of CVS/Root ===")
+  message("${contents}")
+  message("=== end content ===")
+  message("")
+
+  file(READ "${CMake_SOURCE_DIR}/CVS/Repository" contents)
+  message("=== content of CVS/Repository ===")
+  message("${contents}")
+  message("=== end content ===")
+  message("")
+
+  message("Copy/paste this command to reproduce:")
+  message("cd \"${CMake_SOURCE_DIR}\" && \"${CVS_EXECUTABLE}\" -q -n up -dP")
+  message("")
+
+  set(cmd ${CVS_EXECUTABLE} -q -n up -dP)
+endif()
+
+
+if(is_git_checkout AND GIT_EXECUTABLE)
+  # Check with "git status" if there are any local modifications to the
+  # CMake source tree:
+  #
+  message("=============================================================================")
+  message("This is a git checkout, using git to verify source tree....")
+  message("")
+
+  execute_process(COMMAND ${GIT_EXECUTABLE} branch -a
+    WORKING_DIRECTORY ${CMake_SOURCE_DIR}
+    OUTPUT_VARIABLE git_branch_output
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+  message("=== output of 'git branch -a' ===")
+  message("${git_branch_output}")
+  message("=== end output ===")
+  message("")
+
+  message("Copy/paste this command to reproduce:")
+  message("cd \"${CMake_SOURCE_DIR}\" && \"${GIT_EXECUTABLE}\" status")
+  message("")
+
+  set(cmd ${GIT_EXECUTABLE} status)
+endif()
+
+
+if(cmd)
+  # Use the HOME value passed in to the script for calling cvs/git so it can
+  # find its .cvspass or user/global config settings...
+  #
+  set(original_ENV_HOME "$ENV{HOME}")
+  set(ENV{HOME} "${HOME}")
+
+  execute_process(COMMAND ${cmd}
+    WORKING_DIRECTORY ${CMake_SOURCE_DIR}
+    OUTPUT_VARIABLE ov
+    ERROR_VARIABLE ev
+    RESULT_VARIABLE rv)
+
+  set(ENV{HOME} "${original_ENV_HOME}")
+
+  if(NOT rv STREQUAL 0)
+    message(FATAL_ERROR "error: ${cmd} attempt failed... (see output above)")
+  endif()
+
+  message("Results of running ${cmd}")
+  message("rv='${rv}'")
+  message("ov='${ov}'")
+  message("ev='${ev}'")
+  message("")
+else()
+  message(FATAL_ERROR "error: no COMMAND to run to analyze source tree...")
+endif()
+
+
+# Analyze output:
+#
 if(NOT ov STREQUAL "")
   string(REPLACE ";" "\\\\;" lines "${ov}")
   string(REPLACE "\n" "E;" lines "${lines}")
@@ -110,29 +194,44 @@ if(NOT ov STREQUAL "")
     endif()
 
     if(consider)
-      if(line MATCHES "^A ")
-        message("   locally added file/directory detected...")
-        set(additions 1)
-      endif()
-
-      if(line MATCHES "^C ")
-        message("   conflict detected...")
-        set(conflicts 1)
+      if(is_cvs_checkout)
+        if(line MATCHES "^A ")
+          message("   locally added file/directory detected...")
+          set(additions 1)
+        endif()
+
+        if(line MATCHES "^C ")
+          message("   conflict detected...")
+          set(conflicts 1)
+        endif()
+
+        if(line MATCHES "^M ")
+          message("   locally modified file detected...")
+          set(modifications 1)
+        endif()
+
+        if(line MATCHES "^\\? ")
+          message("   locally non-added file/directory detected...")
+          set(nonadditions 1)
+        endif()
       endif()
 
-      if(line MATCHES "^M ")
-        message("   locally modified file detected...")
-        set(modifications 1)
-      endif()
+      if(is_git_checkout)
+        if(line MATCHES "^#[ \t]*modified:")
+          message("   locally modified file detected...")
+          set(modifications 1)
+        endif()
 
-      if(line MATCHES "^\\? ")
-        message("   locally non-added file/directory detected...")
-        set(nonadditions 1)
+        if(line MATCHES "^# Untracked")
+          message("   locally non-added file/directory detected...")
+          set(nonadditions 1)
+        endif()
       endif()
     endif()
   endforeach()
 endif()
 
+
 message("=============================================================================")
 message("additions='${additions}'")
 message("conflicts='${conflicts}'")
@@ -185,14 +284,14 @@ if(nonadditions)
     message("
 warning: test results confounded because this is an 'in-source' build - cannot
 distinguish between non-added files that are in-source build products and
-non-added source files that somebody forgot to 'cvs add'... - this is only ok
+non-added source files that somebody forgot to 'git add'... - this is only ok
 if this is intentionally an in-source dashboard build... Developers should
 use out-of-source builds to verify a clean source tree with this test...
 
 Allowing test to pass despite the warning message...
 ")
   else()
-    message(FATAL_ERROR "test fails: local source tree non-additions: use cvs add before committing, or remove the files from the source tree")
+    message(FATAL_ERROR "test fails: local source tree non-additions: use git add before committing, or remove the files from the source tree")
   endif()
 endif()
 

-----------------------------------------------------------------------

Summary of changes:
 Tests/CMakeTests/CMakeLists.txt               |    5 +-
 Tests/CMakeTests/CheckSourceTreeTest.cmake.in |  201 ++++++++++++++++++-------
 2 files changed, 153 insertions(+), 53 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list