lib git: treat merge commits like any other commit
This commit is contained in:
parent
f28fd55fdc
commit
6569ae6200
|
@ -584,30 +584,14 @@ namespace SparkleLib.Git {
|
|||
|
||||
entries.Add (last_entry);
|
||||
|
||||
Regex merge_regex = new Regex (@"commit ([a-z0-9]{40})\n" +
|
||||
"Merge: .+ .+\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" +
|
||||
"*", RegexOptions.Compiled);
|
||||
|
||||
Regex non_merge_regex = new Regex (@"commit ([a-z0-9]{40})\n" +
|
||||
Regex 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" +
|
||||
"*", RegexOptions.Compiled);
|
||||
|
||||
foreach (string log_entry in entries) {
|
||||
Regex regex;
|
||||
bool is_merge_commit = false;
|
||||
|
||||
if (log_entry.Contains ("\nMerge: ")) {
|
||||
regex = merge_regex;
|
||||
is_merge_commit = true;
|
||||
} else {
|
||||
regex = non_merge_regex;
|
||||
}
|
||||
|
||||
Match match = regex.Match (log_entry);
|
||||
|
||||
if (match.Success) {
|
||||
|
@ -616,7 +600,6 @@ namespace SparkleLib.Git {
|
|||
change_set.Folder = new SparkleFolder (Name);
|
||||
change_set.Revision = match.Groups [1].Value;
|
||||
change_set.User = new SparkleUser (match.Groups [2].Value, match.Groups [3].Value);
|
||||
change_set.IsMagical = is_merge_commit;
|
||||
change_set.RemoteUrl = RemoteUrl;
|
||||
|
||||
change_set.Timestamp = new DateTime (int.Parse (match.Groups [4].Value),
|
||||
|
@ -688,7 +671,7 @@ namespace SparkleLib.Git {
|
|||
change_set.Changes.Add (
|
||||
new SparkleChange () {
|
||||
Path = file_path,
|
||||
MovedPath = to_file_path,
|
||||
MovedToPath = to_file_path,
|
||||
Timestamp = change_set.Timestamp,
|
||||
Type = SparkleChangeType.Moved
|
||||
}
|
||||
|
|
|
@ -32,12 +32,13 @@ namespace SparkleLib {
|
|||
public class SparkleChangeSet {
|
||||
|
||||
public SparkleUser User = new SparkleUser ("Unknown", "Unknown");
|
||||
|
||||
public SparkleFolder Folder;
|
||||
public Uri RemoteUrl;
|
||||
|
||||
public string Revision;
|
||||
public DateTime Timestamp;
|
||||
public DateTime FirstTimestamp;
|
||||
public bool IsMagical;
|
||||
public Uri RemoteUrl;
|
||||
public List<SparkleChange> Changes = new List<SparkleChange> ();
|
||||
}
|
||||
|
||||
|
@ -46,7 +47,7 @@ namespace SparkleLib {
|
|||
|
||||
public SparkleChangeType Type;
|
||||
public string Path;
|
||||
public string MovedPath;
|
||||
public string MovedToPath;
|
||||
public DateTime Timestamp;
|
||||
}
|
||||
|
||||
|
|
|
@ -393,10 +393,6 @@ namespace SparkleShare {
|
|||
foreach (SparkleChangeSet change_set in activity_day) {
|
||||
string event_entry = "<dl>";
|
||||
|
||||
if (change_set.IsMagical) {
|
||||
event_entry += "<dd>Did something magical</dd>";
|
||||
|
||||
} else {
|
||||
foreach (SparkleChange change in change_set.Changes) {
|
||||
if (change.Type != SparkleChangeType.Moved) {
|
||||
|
||||
|
@ -411,12 +407,11 @@ namespace SparkleShare {
|
|||
event_entry += FormatBreadCrumbs (change_set.Folder.FullPath, change.Path);
|
||||
event_entry += "<br>";
|
||||
event_entry += "<small>" + change.Timestamp.ToString ("HH:mm") +"</small> ";
|
||||
event_entry += FormatBreadCrumbs (change_set.Folder.FullPath, change.MovedPath);
|
||||
event_entry += FormatBreadCrumbs (change_set.Folder.FullPath, change.MovedToPath);
|
||||
event_entry += "</dd>";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string change_set_avatar = GetAvatar (change_set.User.Email, 48);
|
||||
|
||||
|
|
Loading…
Reference in a new issue