Support showing merge commits in logs (and fix crashes caused by them being missing)
This commit is contained in:
parent
46c91560c4
commit
3061844ee7
|
@ -26,6 +26,7 @@ namespace SparkleLib {
|
||||||
public string UserEmail;
|
public string UserEmail;
|
||||||
public DateTime DateTime;
|
public DateTime DateTime;
|
||||||
public string Hash;
|
public string Hash;
|
||||||
|
public bool IsMerge;
|
||||||
|
|
||||||
public List <string> Added;
|
public List <string> Added;
|
||||||
public List <string> Deleted;
|
public List <string> Deleted;
|
||||||
|
|
|
@ -771,7 +771,7 @@ namespace SparkleLib {
|
||||||
git.WaitForExit ();
|
git.WaitForExit ();
|
||||||
|
|
||||||
_CurrentHash = Head.CurrentCommit.Hash;
|
_CurrentHash = Head.CurrentCommit.Hash;
|
||||||
|
Console.WriteLine ("!!!!" + LocalPath + ": " + GetCommits (1).Count);
|
||||||
if (NewCommit != null)
|
if (NewCommit != null)
|
||||||
NewCommit (GetCommits (1) [0], LocalPath);
|
NewCommit (GetCommits (1) [0], LocalPath);
|
||||||
|
|
||||||
|
@ -977,12 +977,30 @@ namespace SparkleLib {
|
||||||
|
|
||||||
foreach (string log_entry in entries) {
|
foreach (string log_entry in entries) {
|
||||||
|
|
||||||
Regex regex = new Regex (@"commit ([a-z0-9]{40})\n" +
|
Regex regex;
|
||||||
|
bool is_merge_commit = false;
|
||||||
|
|
||||||
|
if (log_entry.Contains ("\nMerge: ")) {
|
||||||
|
|
||||||
|
regex = new Regex (@"commit ([a-z0-9]{40})\n" +
|
||||||
|
"Merge: .+ .+\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" +
|
||||||
"*");
|
"*");
|
||||||
|
|
||||||
|
is_merge_commit = true;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
regex = new Regex (@"commit ([a-z0-9]{40})\n" +
|
||||||
|
"Author: (.+) <(.+)>\n" +
|
||||||
|
"Date: ([0-9]{4})-([0-9]{2})-([0-9]{2}) " +
|
||||||
|
"([0-9]{2}):([0-9]{2}):([0-9]{2}) \\+([0-9]{4})\n" +
|
||||||
|
"*");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Match match = regex.Match (log_entry);
|
Match match = regex.Match (log_entry);
|
||||||
|
|
||||||
if (match.Success) {
|
if (match.Success) {
|
||||||
|
@ -992,6 +1010,7 @@ namespace SparkleLib {
|
||||||
commit.Hash = match.Groups [1].Value;
|
commit.Hash = match.Groups [1].Value;
|
||||||
commit.UserName = match.Groups [2].Value;
|
commit.UserName = match.Groups [2].Value;
|
||||||
commit.UserEmail = match.Groups [3].Value;
|
commit.UserEmail = match.Groups [3].Value;
|
||||||
|
commit.IsMerge = is_merge_commit;
|
||||||
|
|
||||||
commit.DateTime = new DateTime (int.Parse (match.Groups [4].Value),
|
commit.DateTime = 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),
|
||||||
|
|
|
@ -318,6 +318,8 @@ namespace SparkleShare {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (change_set.IsMerge)
|
||||||
|
event_entry += "<dt>Merged a branch</dt>";
|
||||||
|
|
||||||
if (change_set.Added.Count > 0) {
|
if (change_set.Added.Count > 0) {
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!hide_ui) {
|
if (Controller != null) {
|
||||||
|
|
||||||
UI = new SparkleUI ();
|
UI = new SparkleUI ();
|
||||||
UI.Run ();
|
UI.Run ();
|
||||||
|
|
|
@ -51,7 +51,7 @@ namespace SparkleShare {
|
||||||
StatusIcon = new SparkleStatusIcon ();
|
StatusIcon = new SparkleStatusIcon ();
|
||||||
|
|
||||||
// Keep track of which event logs are open
|
// Keep track of which event logs are open
|
||||||
SparkleUI.OpenLogs = new List <SparkleLog> ();
|
OpenLogs = new List <SparkleLog> ();
|
||||||
|
|
||||||
if (SparkleShare.Controller.FirstRun) {
|
if (SparkleShare.Controller.FirstRun) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue