/// <summary> /// Process severity. /// </summary> /// <remarks> /// Can be null. /// </remarks> private static BugSeverity?ProcessSeverity(Record record) { BugSeverity value = BugSeverity.Fatal; string str = record[SeverityCol]; bool found = str != null?s_severityMappings.TryGetValue(str, out value) : false; return(found ? new BugSeverity?(value) : null); }
public BugFixInfo(BugSeverity severity, string description) { _severity = severity; _description = description; }
private static List <VersionUpdateInfo> ParseChanges(Stream s) { Regex versionRx = new Regex(@"^\[((\d+)\.(\d+)\.(\d+)\.(\d+))\]"); Regex propRx = new Regex(@"^((\w+)(\((\w+)\))?)\s*\=\s*(.*)$"); Regex dateRx = new Regex(@"(\d\d\d\d)\-(\d\d)\-(\d\d)"); List <VersionUpdateInfo> res = new List <VersionUpdateInfo>(); using (StreamReader reader = new StreamReader(s)) { VersionUpdateInfo vinfo = null; while (!reader.EndOfStream) { string line = reader.ReadLine(); Match m = versionRx.Match(line); if (m.Success) { if (vinfo != null) { res.Add(vinfo); } vinfo = new VersionUpdateInfo(); vinfo.Version = m.Groups[1].Value; } else { m = propRx.Match(line); if (m.Success) { string pname = m.Groups[2].Value.ToLower(); if (pname == "bug") { if (m.Groups[4].Success) { string sev = m.Groups[4].Value.ToLower(); BugSeverity severity = BugSeverity.None; if (sev == "minor") { severity = BugSeverity.Minor; } else if (sev == "major") { severity = BugSeverity.Major; } else if (sev == "critical") { severity = BugSeverity.Critical; } if (severity != BugSeverity.None) { BugFixInfo bug = new BugFixInfo(severity, m.Groups[5].Value); vinfo.FixedBugs.Add(bug); } } // if } else if (pname == "feature") { if (m.Groups[4].Success) { string imp = m.Groups[4].Value.ToLower(); FeatureImpact impact = FeatureImpact.None; if (imp == "minor") { impact = FeatureImpact.Minor; } else if (imp == "major") { impact = FeatureImpact.Major; } if (impact != FeatureImpact.None) { FeatureInfo feature = new FeatureInfo(impact, m.Groups[5].Value); vinfo.AddedFeatures.Add(feature); } } // if } else if (pname == "release") { string datestr = m.Groups[5].Value; m = dateRx.Match(datestr); if (m.Success) { int year = int.Parse(m.Groups[1].Value); int month = int.Parse(m.Groups[2].Value); int day = int.Parse(m.Groups[3].Value); vinfo.ReleaseDate = new DateTime(year, month, day); } } } } // else } // while if (vinfo != null) { res.Add(vinfo); } } // using if (res.Count == 0) { return(null); } else { return(res); } }