[Cmake-commits] CMake branch, next, updated. v2.8.4-982-g3a7d3d9
Brad King
brad.king at kitware.com
Tue Feb 22 15:49:43 EST 2011
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 3a7d3d97b136c81c26c411ab4539e2bd20d7642f (commit)
via 1173cc4ab2dc23a2ac51442273127d2f909f3bc8 (commit)
from 88a0a0e8e8ce50ce527ecbf3d86022ae7f031b6a (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=3a7d3d97b136c81c26c411ab4539e2bd20d7642f
commit 3a7d3d97b136c81c26c411ab4539e2bd20d7642f
Merge: 88a0a0e 1173cc4
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Feb 22 15:49:40 2011 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Feb 22 15:49:40 2011 -0500
Merge topic 'ctest-git-submodule-recursive' into next
1173cc4 CTest: Update Git submodules with --recursive
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1173cc4ab2dc23a2ac51442273127d2f909f3bc8
commit 1173cc4ab2dc23a2ac51442273127d2f909f3bc8
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Feb 22 15:47:50 2011 -0500
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Feb 22 15:47:50 2011 -0500
CTest: Update Git submodules with --recursive
Fail if submodules exist and the git version is less than 1.6.5.0.
Inspired-by: Johan Björk <phb at spotify.com>
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index aa9e55b..3f55f85 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -24,10 +24,19 @@
#include <ctype.h>
//----------------------------------------------------------------------------
+static unsigned int cmCTestGITVersion(unsigned int epic, unsigned int major,
+ unsigned int minor, unsigned int fix)
+{
+ // 1.6.5.0 maps to 10605000
+ return fix + minor*1000 + major*100000 + epic*10000000;
+}
+
+//----------------------------------------------------------------------------
cmCTestGIT::cmCTestGIT(cmCTest* ct, std::ostream& log):
cmCTestGlobalVC(ct, log)
{
this->PriorRev = this->Unknown;
+ this->CurrentGitVersion = 0;
}
//----------------------------------------------------------------------------
@@ -263,7 +272,21 @@ bool cmCTestGIT::UpdateImpl()
std::string top_dir = this->FindTopDir();
const char* git = this->CommandLineTool.c_str();
- char const* git_submodule[] = {git, "submodule", "update", 0};
+ const char* recursive = "--recursive";
+
+ // Git < 1.6.5.0 did not support --recursive
+ if(this->GetGitVersion() < cmCTestGITVersion(1,6,5,0))
+ {
+ recursive = 0;
+ // No need to require >= 1.6.5.0 if there are no submodules.
+ if(cmSystemTools::FileExists((top_dir + "/.gitmodules").c_str()))
+ {
+ this->Log << "Git >= 1.6.5.0 required for submodule support\n";
+ return false;
+ }
+ }
+
+ char const* git_submodule[] = {git, "submodule", "update", recursive, 0};
OutputLogger submodule_out(this->Log, "submodule-out> ");
OutputLogger submodule_err(this->Log, "submodule-err> ");
return this->RunChild(git_submodule, &submodule_out, &submodule_err,
@@ -271,6 +294,27 @@ bool cmCTestGIT::UpdateImpl()
}
//----------------------------------------------------------------------------
+unsigned int cmCTestGIT::GetGitVersion()
+{
+ if(!this->CurrentGitVersion)
+ {
+ const char* git = this->CommandLineTool.c_str();
+ char const* git_version[] = {git, "--version", 0};
+ std::string version;
+ OneLineParser version_out(this, "version-out> ", version);
+ OutputLogger version_err(this->Log, "version-err> ");
+ unsigned int v[4] = {0,0,0,0};
+ if(this->RunChild(git_version, &version_out, &version_err) &&
+ sscanf(version.c_str(), "git version %u.%u.%u.%u",
+ &v[0], &v[1], &v[2], &v[3]) >= 3)
+ {
+ this->CurrentGitVersion = cmCTestGITVersion(v[0], v[1], v[2], v[3]);
+ }
+ }
+ return this->CurrentGitVersion;
+}
+
+//----------------------------------------------------------------------------
/* Diff format:
:src-mode dst-mode src-sha1 dst-sha1 status\0
diff --git a/Source/CTest/cmCTestGIT.h b/Source/CTest/cmCTestGIT.h
index 1765340..f4fae8f 100644
--- a/Source/CTest/cmCTestGIT.h
+++ b/Source/CTest/cmCTestGIT.h
@@ -27,6 +27,8 @@ public:
virtual ~cmCTestGIT();
private:
+ unsigned int CurrentGitVersion;
+ unsigned int GetGitVersion();
std::string GetWorkingRevision();
virtual void NoteOldRevision();
virtual void NoteNewRevision();
-----------------------------------------------------------------------
Summary of changes:
Source/CTest/cmCTestGIT.cxx | 46 ++++++++++++++++++++++++++++++++++++++++++-
Source/CTest/cmCTestGIT.h | 2 +
2 files changed, 47 insertions(+), 1 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list