summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-12-18 13:13:51 (GMT)
committerBrad King <brad.king@kitware.com>2009-12-18 13:13:51 (GMT)
commita73833d03742c504a6b8927cc276d5e34e1aeab2 (patch)
tree3d15b0ffc4de2534ec35d840b82f8fb1485e7fcc
parent449b9aea23442de90e54ecc506a34257f4d3783e (diff)
downloadCMake-a73833d03742c504a6b8927cc276d5e34e1aeab2.zip
CMake-a73833d03742c504a6b8927cc276d5e34e1aeab2.tar.gz
CMake-a73833d03742c504a6b8927cc276d5e34e1aeab2.tar.bz2
Submit global tree revision in Update.xml
We teach CTest to report in a <Revision> element the revision of the source tree that was tested. This makes sense for all modern VCS tools because they version the whole tree. We simply omit this element for CVS because it only versions files. See issue #7541.
-rw-r--r--Source/CTest/cmCTestGlobalVC.cxx15
-rw-r--r--Source/CTest/cmCTestGlobalVC.h1
-rw-r--r--Tests/CTestUpdateCVS.cmake.in1
-rw-r--r--Tests/CTestUpdateCommon.cmake19
4 files changed, 36 insertions, 0 deletions
diff --git a/Source/CTest/cmCTestGlobalVC.cxx b/Source/CTest/cmCTestGlobalVC.cxx
index 73a36da..8c51102 100644
--- a/Source/CTest/cmCTestGlobalVC.cxx
+++ b/Source/CTest/cmCTestGlobalVC.cxx
@@ -107,6 +107,19 @@ void cmCTestGlobalVC::WriteXMLDirectory(std::ostream& xml,
}
//----------------------------------------------------------------------------
+void cmCTestGlobalVC::WriteXMLGlobal(std::ostream& xml)
+{
+ if(!this->NewRevision.empty())
+ {
+ xml << "\t<Revision>" << this->NewRevision << "</Revision>\n";
+ }
+ if(!this->OldRevision.empty() && this->OldRevision != this->NewRevision)
+ {
+ xml << "\t<PriorRevision>" << this->OldRevision << "</PriorRevision>\n";
+ }
+}
+
+//----------------------------------------------------------------------------
bool cmCTestGlobalVC::WriteXMLUpdates(std::ostream& xml)
{
cmCTestLog(this->CTest, HANDLER_OUTPUT,
@@ -117,6 +130,8 @@ bool cmCTestGlobalVC::WriteXMLUpdates(std::ostream& xml)
this->LoadModifications();
+ this->WriteXMLGlobal(xml);
+
for(std::map<cmStdString, Directory>::const_iterator
di = this->Dirs.begin(); di != this->Dirs.end(); ++di)
{
diff --git a/Source/CTest/cmCTestGlobalVC.h b/Source/CTest/cmCTestGlobalVC.h
index d88016b..a648a59 100644
--- a/Source/CTest/cmCTestGlobalVC.h
+++ b/Source/CTest/cmCTestGlobalVC.h
@@ -60,6 +60,7 @@ protected:
virtual void LoadModifications() = 0;
virtual void LoadRevisions() = 0;
+ virtual void WriteXMLGlobal(std::ostream& xml);
void WriteXMLDirectory(std::ostream& xml, std::string const& path,
Directory const& dir);
};
diff --git a/Tests/CTestUpdateCVS.cmake.in b/Tests/CTestUpdateCVS.cmake.in
index 8ac0fa1..1509adf 100644
--- a/Tests/CTestUpdateCVS.cmake.in
+++ b/Tests/CTestUpdateCVS.cmake.in
@@ -5,6 +5,7 @@
# Test in a directory next to this script.
get_filename_component(TOP "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(TOP "${TOP}/@CTestUpdateCVS_DIR@")
+set(UPDATE_NOT_GLOBAL 1)
# Include code common to all update tests.
include("@CMAKE_CURRENT_SOURCE_DIR@/CTestUpdateCommon.cmake")
diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake
index b680b8e..211a0fa 100644
--- a/Tests/CTestUpdateCommon.cmake
+++ b/Tests/CTestUpdateCommon.cmake
@@ -45,6 +45,25 @@ function(check_updates build)
endif()
endforeach(f)
+ if(NOT UPDATE_NOT_GLOBAL)
+ set(rev_elements "Revision|PriorRevision")
+ set(rev_regex "^\t<(${rev_elements})>[^<\n]+</(${rev_elements})>$")
+ file(STRINGS ${TOP}/${UPDATE_XML_FILE} UPDATE_XML_REVISIONS
+ REGEX "${rev_regex}"
+ LIMIT_INPUT 4096
+ )
+ foreach(r IN LISTS UPDATE_XML_REVISIONS)
+ string(REGEX REPLACE "${rev_regex}" "\\1" element "${r}")
+ set(element_${element} 1)
+ endforeach()
+ string(REPLACE "|" ";" rev_elements "${rev_elements}")
+ foreach(element ${rev_elements})
+ if(NOT element_${element})
+ list(APPEND MISSING "global <${element}> element")
+ endif()
+ endforeach()
+ endif()
+
# Report the result
if(MISSING)
# List the missing entries