summaryrefslogtreecommitdiffstats
path: root/Source/CTest
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-12-21 19:02:39 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2010-12-21 19:02:39 (GMT)
commitea38628366634189502b57c53d866bc436eb7c7f (patch)
treeca0f5c999fdf543faa52b9424cbfb6e7ff7099a1 /Source/CTest
parent3a7edc14a076126c34ee3db14da46d4c9bc345ab (diff)
parent59925264829e5c9509f505897aafd33478e80cfe (diff)
downloadCMake-ea38628366634189502b57c53d866bc436eb7c7f.zip
CMake-ea38628366634189502b57c53d866bc436eb7c7f.tar.gz
CMake-ea38628366634189502b57c53d866bc436eb7c7f.tar.bz2
Merge topic 'ctest-git-send-committer'
5992526 CTest: Factor out duplicate Git author/committer code 307b8a6 CTest git update should pass the committer as well as the author
Diffstat (limited to 'Source/CTest')
-rw-r--r--Source/CTest/cmCTestGIT.cxx57
-rw-r--r--Source/CTest/cmCTestVC.cxx5
-rw-r--r--Source/CTest/cmCTestVC.h3
3 files changed, 43 insertions, 22 deletions
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index a6f10ec..aa9e55b 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -503,28 +503,15 @@ private:
this->ParsePerson(this->Line.c_str()+7, author);
this->Rev.Author = author.Name;
this->Rev.EMail = author.EMail;
-
- // Convert the time to a human-readable format that is also easy
- // to machine-parse: "CCYY-MM-DD hh:mm:ss".
- time_t seconds = static_cast<time_t>(author.Time);
- struct tm* t = gmtime(&seconds);
- char dt[1024];
- sprintf(dt, "%04d-%02d-%02d %02d:%02d:%02d",
- t->tm_year+1900, t->tm_mon+1, t->tm_mday,
- t->tm_hour, t->tm_min, t->tm_sec);
- this->Rev.Date = dt;
-
- // Add the time-zone field "+zone" or "-zone".
- char tz[32];
- if(author.TimeZone >= 0)
- {
- sprintf(tz, " +%04ld", author.TimeZone);
- }
- else
- {
- sprintf(tz, " -%04ld", -author.TimeZone);
- }
- this->Rev.Date += tz;
+ this->Rev.Date = this->FormatDateTime(author);
+ }
+ else if(strncmp(this->Line.c_str(), "committer ", 10) == 0)
+ {
+ Person committer;
+ this->ParsePerson(this->Line.c_str()+10, committer);
+ this->Rev.Committer = committer.Name;
+ this->Rev.CommitterEMail = committer.EMail;
+ this->Rev.CommitDate = this->FormatDateTime(committer);
}
}
@@ -537,6 +524,32 @@ private:
}
this->Rev.Log += "\n";
}
+
+ std::string FormatDateTime(Person const& person)
+ {
+ // Convert the time to a human-readable format that is also easy
+ // to machine-parse: "CCYY-MM-DD hh:mm:ss".
+ time_t seconds = static_cast<time_t>(person.Time);
+ struct tm* t = gmtime(&seconds);
+ char dt[1024];
+ sprintf(dt, "%04d-%02d-%02d %02d:%02d:%02d",
+ t->tm_year+1900, t->tm_mon+1, t->tm_mday,
+ t->tm_hour, t->tm_min, t->tm_sec);
+ std::string out = dt;
+
+ // Add the time-zone field "+zone" or "-zone".
+ char tz[32];
+ if(person.TimeZone >= 0)
+ {
+ sprintf(tz, " +%04ld", person.TimeZone);
+ }
+ else
+ {
+ sprintf(tz, " -%04ld", -person.TimeZone);
+ }
+ out += tz;
+ return out;
+ }
};
char const cmCTestGIT::CommitParser::SectionSep[SectionCount] =
diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx
index f9ad79a..fbee227 100644
--- a/Source/CTest/cmCTestVC.cxx
+++ b/Source/CTest/cmCTestVC.cxx
@@ -228,6 +228,11 @@ void cmCTestVC::WriteXMLEntry(std::ostream& xml,
<< "\t\t\t<CheckinDate>" << cmXMLSafe(rev.Date) << "</CheckinDate>\n"
<< "\t\t\t<Author>" << cmXMLSafe(rev.Author) << "</Author>\n"
<< "\t\t\t<Email>" << cmXMLSafe(rev.EMail) << "</Email>\n"
+ << "\t\t\t<Committer>" << cmXMLSafe(rev.Committer) << "</Committer>\n"
+ << "\t\t\t<CommitterEmail>" << cmXMLSafe(rev.CommitterEMail)
+ << "</CommitterEmail>\n"
+ << "\t\t\t<CommitDate>" << cmXMLSafe(rev.CommitDate)
+ << "</CommitDate>\n"
<< "\t\t\t<Log>" << cmXMLSafe(rev.Log) << "</Log>\n"
<< "\t\t\t<Revision>" << cmXMLSafe(rev.Rev) << "</Revision>\n"
<< "\t\t\t<PriorRevision>" << cmXMLSafe(prior) << "</PriorRevision>\n"
diff --git a/Source/CTest/cmCTestVC.h b/Source/CTest/cmCTestVC.h
index d36bc8f..44e1dac 100644
--- a/Source/CTest/cmCTestVC.h
+++ b/Source/CTest/cmCTestVC.h
@@ -74,6 +74,9 @@ protected:
std::string Date;
std::string Author;
std::string EMail;
+ std::string Committer;
+ std::string CommitterEMail;
+ std::string CommitDate;
std::string Log;
};