repo: controller: bring back support for renames in event logs
This commit is contained in:
parent
28aa6d2305
commit
8fc3ad11ca
|
@ -811,7 +811,7 @@ namespace SparkleLib {
|
|||
|
||||
List <SparkleCommit> commits = new List <SparkleCommit> ();
|
||||
|
||||
SparkleGit git_log = new SparkleGit (LocalPath, "log -" + count + " --raw --date=iso");
|
||||
SparkleGit git_log = new SparkleGit (LocalPath, "log -" + count + " --raw -M --date=iso");
|
||||
Console.OutputEncoding = System.Text.Encoding.Unicode;
|
||||
git_log.Start ();
|
||||
|
||||
|
@ -883,6 +883,7 @@ namespace SparkleLib {
|
|||
|
||||
string change_type = entry_line [37].ToString ();
|
||||
string file_path = entry_line.Substring (39);
|
||||
string to_file_path;
|
||||
|
||||
if (change_type.Equals ("A")) {
|
||||
commit.Added.Add (file_path);
|
||||
|
@ -890,6 +891,13 @@ namespace SparkleLib {
|
|||
commit.Edited.Add (file_path);
|
||||
} else if (change_type.Equals ("D")) {
|
||||
commit.Deleted.Add (file_path);
|
||||
} else if (change_type.Equals ("R")) {
|
||||
int tab_pos = entry_line.LastIndexOf ("\t");
|
||||
file_path = entry_line.Substring (42, tab_pos - 42);
|
||||
to_file_path = entry_line.Substring (tab_pos + 1);
|
||||
|
||||
commit.MovedFrom.Add (file_path);
|
||||
commit.MovedTo.Add (to_file_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -379,29 +379,53 @@ namespace SparkleShare {
|
|||
|
||||
}
|
||||
|
||||
if (change_set.Deleted.Count > 0) {
|
||||
if (change_set.Deleted.Count > 0) {
|
||||
|
||||
event_entry += "<dt>Deleted</dt>";
|
||||
event_entry += "<dt>Deleted</dt>";
|
||||
|
||||
foreach (string file_path in change_set.Deleted) {
|
||||
foreach (string file_path in change_set.Deleted) {
|
||||
|
||||
string absolute_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath,
|
||||
name, file_path);
|
||||
string absolute_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath,
|
||||
name, file_path);
|
||||
|
||||
if (File.Exists (absolute_file_path)) {
|
||||
if (File.Exists (absolute_file_path)) {
|
||||
|
||||
event_entry += "<dd><a href='" + absolute_file_path + "'>" + file_path + "</a></dd>";
|
||||
event_entry += "<dd><a href='" + absolute_file_path + "'>" + file_path + "</a></dd>";
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
event_entry += "<dd>" + file_path + "</dd>";
|
||||
event_entry += "<dd>" + file_path + "</dd>";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (change_set.MovedFrom.Count > 0) {
|
||||
event_entry += "<dt>Moved</dt>";
|
||||
|
||||
int i = 0;
|
||||
foreach (string file_path in change_set.MovedFrom) {
|
||||
string to_file_path = change_set.MovedTo [i];
|
||||
string absolute_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath,
|
||||
name, file_path);
|
||||
string absolute_to_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath,
|
||||
name, to_file_path);
|
||||
|
||||
if (File.Exists (absolute_file_path))
|
||||
event_entry += "<dd><a href='" + absolute_file_path + "'>" + file_path + "</a><br/><span class='moved-arrow'>→</span> ";
|
||||
else
|
||||
event_entry += "<dd>" + file_path + "<br/><span class='moved-arrow'>→</span> ";
|
||||
|
||||
if (File.Exists (absolute_to_file_path))
|
||||
event_entry += "<a href='" + absolute_to_file_path + "'>" + to_file_path + "</a></dd>";
|
||||
else
|
||||
event_entry += to_file_path + "</dd>";
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event_entry += "</dl>";
|
||||
|
|
|
@ -18,9 +18,13 @@
|
|||
}
|
||||
|
||||
small {
|
||||
font-size: <!-- $small-font-size -->;
|
||||
color: <!-- $small-color -->;
|
||||
}
|
||||
font-size: <!-- $small-font-size -->;
|
||||
color: <!-- $small-color -->;
|
||||
}
|
||||
|
||||
.moved-arrow {
|
||||
color: <!-- $secondary-font-color -->;
|
||||
}
|
||||
|
||||
.day-entry-header {
|
||||
font-size: <!-- $day-entry-header-font-size -->;
|
||||
|
|
Loading…
Reference in a new issue