repo: normalise timezones for the log
This commit is contained in:
parent
a7547f5076
commit
6926638822
|
@ -387,7 +387,7 @@ namespace SparkleLib {
|
||||||
Regex non_merge_regex = new Regex (@"commit ([a-z0-9]{40})\n" +
|
Regex non_merge_regex = new Regex (@"commit ([a-z0-9]{40})\n" +
|
||||||
"Author: (.+) <(.+)>\n" +
|
"Author: (.+) <(.+)>\n" +
|
||||||
"Date: ([0-9]{4})-([0-9]{2})-([0-9]{2}) " +
|
"Date: ([0-9]{4})-([0-9]{2})-([0-9]{2}) " +
|
||||||
"([0-9]{2}):([0-9]{2}):([0-9]{2}) .([0-9]{4})\n" +
|
"([0-9]{2}):([0-9]{2}):([0-9]{2}) (.[0-9]{4})\n" +
|
||||||
"*", RegexOptions.Compiled);
|
"*", RegexOptions.Compiled);
|
||||||
|
|
||||||
// TODO: Need to optimise for speed
|
// TODO: Need to optimise for speed
|
||||||
|
@ -412,11 +412,24 @@ namespace SparkleLib {
|
||||||
change_set.UserEmail = match.Groups [3].Value;
|
change_set.UserEmail = match.Groups [3].Value;
|
||||||
change_set.IsMerge = is_merge_commit;
|
change_set.IsMerge = is_merge_commit;
|
||||||
|
|
||||||
|
|
||||||
change_set.Timestamp = new DateTime (int.Parse (match.Groups [4].Value),
|
change_set.Timestamp = new DateTime (int.Parse (match.Groups [4].Value),
|
||||||
int.Parse (match.Groups [5].Value), int.Parse (match.Groups [6].Value),
|
int.Parse (match.Groups [5].Value), int.Parse (match.Groups [6].Value),
|
||||||
int.Parse (match.Groups [7].Value), int.Parse (match.Groups [8].Value),
|
int.Parse (match.Groups [7].Value), int.Parse (match.Groups [8].Value),
|
||||||
int.Parse (match.Groups [9].Value));
|
int.Parse (match.Groups [9].Value));
|
||||||
|
|
||||||
|
string time_zone = match.Groups [10].Value;
|
||||||
|
int hours_offset = int.Parse (time_zone.Substring (1, 2));
|
||||||
|
|
||||||
|
if (DateTime.Now.IsDaylightSavingTime ())
|
||||||
|
hours_offset--;
|
||||||
|
|
||||||
|
if (time_zone.StartsWith ("+"))
|
||||||
|
change_set.Timestamp.AddHours (hours_offset);
|
||||||
|
else
|
||||||
|
change_set.Timestamp.AddHours (hours_offset * -1);
|
||||||
|
|
||||||
|
|
||||||
string [] entry_lines = log_entry.Split ("\n".ToCharArray ());
|
string [] entry_lines = log_entry.Split ("\n".ToCharArray ());
|
||||||
|
|
||||||
foreach (string entry_line in entry_lines) {
|
foreach (string entry_line in entry_lines) {
|
||||||
|
|
Loading…
Reference in a new issue