/* * ________________________________________________________________________________ * # Method: # * # # * # Usage: # * # # * # Parameters: # * # # * # Returns: # * # # * # Last Date Modified: # * # # * # Last Modified By: # * # # * ________________________________________________________________________________ */ public static string Get_Last_Commit_Message() { if (ManagerData.Selected_Repo != null) { EntryCell commit = ManagerData.Selected_Repo.Logs.Values.First().First(); return(commit.Message); } else { return(string.Empty); } }
/* * ________________________________________________________________________________ * # Method: # * # # * # Usage: # * # # * # Parameters: # * # # * # Returns: # * # # * # Last Date Modified: # * # # * # Last Modified By: # * # # * ________________________________________________________________________________ */ public static DateTime Get_Last_Commit() { if (ManagerData.Selected_Repo != null) { EntryCell commit = ManagerData.Selected_Repo.Logs.Values.First().First(); return(commit.Date); } else { return(DateTime.MinValue); } }
/* * ________________________________________________________________________________ * # Method: # * # # * # Usage: # * # # * # Parameters: # * # # * # Returns: # * # # * # Last Date Modified: # * # # * # Last Modified By: # * # # * ________________________________________________________________________________ */ public static List <EntryCell> Parse_Logs(string Full_Log, RepoCell currRepo = null) { // Get a list of matches that match the log format // There will probably be two sets, one for the ID and one for the message // Each should align with the other in seperate lists i.e. index 0 in the id list aligns with index 0 in the message list string currID = ""; string currAuthor = ""; string currDate = ""; string currMessage = ""; Regex rgx = new Regex(Properties.Resources.REGEX_LOG_PATTERN, RegexOptions.IgnoreCase | RegexOptions.Multiline); List <EntryCell> Entries = new List <EntryCell>(); var matches = rgx.Matches(Full_Log); bool first = true; foreach (Match commit in matches) { currID = commit.Groups[1].Value; currAuthor = commit.Groups[2].Value; currDate = commit.Groups[3].Value; currMessage = commit.Groups[4].Value; EntryCell entry = new EntryCell { ID = currID, Author = currAuthor, Message = currMessage }; DateTime temp = DateTime.MinValue; currDate = currDate.Trim(); temp = DateTime.ParseExact(currDate, "ddd MMM d HH:mm:ss yyyy zz00", null); entry.Date = temp; Entries.Add(entry); string shortID = currID.Substring(0, 8); if (first) { first = false; if (currRepo.Last_Commit == DateTime.MinValue && currRepo.Last_Commit != null || Properties.Settings.Default.LogParseMethod == 1) { currRepo.Last_Commit = entry.Date; } if (currRepo.Last_Commit_Message == string.Empty || currRepo.Last_Commit_Message == null || Properties.Settings.Default.LogParseMethod == 1) { currRepo.Last_Commit_Message = entry.Message; } } if (currRepo != null) { if (currRepo.Logs != null) { if (currRepo.Logs.Keys.Contains(currID.Substring(0, 8))) { currRepo.Logs[shortID].Add(entry); } else { currRepo.Logs.Add(shortID, new List <EntryCell>()); currRepo.Logs[shortID].Add(entry); } } else { currRepo.Logs = new Dictionary <string, List <EntryCell> >(); currRepo.Logs.Add(shortID, new List <EntryCell>()); currRepo.Logs[shortID].Add(entry); } } } return(Entries); }