[Cmake-commits] CMake branch, next, updated. v2.8.3-1037-g9643572

Brad King brad.king at kitware.com
Mon Dec 20 17:20:41 EST 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  96435728e168bc42b03b3824c8acf2284ae6e4f7 (commit)
       via  59925264829e5c9509f505897aafd33478e80cfe (commit)
      from  f7d29ee913d168749ae3f424ce32794182866e12 (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=96435728e168bc42b03b3824c8acf2284ae6e4f7
commit 96435728e168bc42b03b3824c8acf2284ae6e4f7
Merge: f7d29ee 5992526
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Dec 20 17:20:39 2010 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Dec 20 17:20:39 2010 -0500

    Merge topic 'ctest-git-send-committer' into next
    
    5992526 CTest: Factor out duplicate Git author/committer code


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=59925264829e5c9509f505897aafd33478e80cfe
commit 59925264829e5c9509f505897aafd33478e80cfe
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Dec 20 17:16:25 2010 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Dec 20 17:16:25 2010 -0500

    CTest: Factor out duplicate Git author/committer code
    
    Factor out date/time format code into FormatDateTime function instead of
    duplicating it.

diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index 3456ec4..aa9e55b 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -503,28 +503,7 @@ 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)
       {
@@ -532,28 +511,7 @@ private:
       this->ParsePerson(this->Line.c_str()+10, committer);
       this->Rev.Committer = committer.Name;
       this->Rev.CommitterEMail = committer.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>(committer.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.CommitDate = dt;
-
-      // Add the time-zone field "+zone" or "-zone".
-      char tz[32];
-      if(committer.TimeZone >= 0)
-        {
-        sprintf(tz, " +%04ld", committer.TimeZone);
-        }
-      else
-        {
-        sprintf(tz, " -%04ld", -committer.TimeZone);
-        }
-      this->Rev.CommitDate += tz;
+      this->Rev.CommitDate = this->FormatDateTime(committer);
       }
     }
 
@@ -566,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] =

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

Summary of changes:
 Source/CTest/cmCTestGIT.cxx |   72 ++++++++++++++++--------------------------
 1 files changed, 28 insertions(+), 44 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list