diff --git a/SparkleLib/Makefile.am b/SparkleLib/Makefile.am
index be122afc..d0268032 100644
--- a/SparkleLib/Makefile.am
+++ b/SparkleLib/Makefile.am
@@ -6,7 +6,7 @@ LINK = $(REF_SPARKLELIB)
SOURCES = \
Defines.cs \
SparkleBackend.cs \
- SparkleCommit.cs \
+ SparkleChangeSet.cs \
SparkleEvents.cs \
SparkleFetcherBase.cs \
SparkleFetcherGit.cs \
diff --git a/SparkleLib/SparkleCommit.cs b/SparkleLib/SparkleChangeSet.cs
similarity index 97%
rename from SparkleLib/SparkleCommit.cs
rename to SparkleLib/SparkleChangeSet.cs
index f6ff7cc7..7de6c87c 100644
--- a/SparkleLib/SparkleCommit.cs
+++ b/SparkleLib/SparkleChangeSet.cs
@@ -20,7 +20,7 @@ using System.Collections.Generic;
namespace SparkleLib {
- public class SparkleCommit {
+ public class SparkleChangeSet {
public string UserName;
public string UserEmail;
diff --git a/SparkleLib/SparkleLib.csproj b/SparkleLib/SparkleLib.csproj
index 1aff1ff6..4252af54 100644
--- a/SparkleLib/SparkleLib.csproj
+++ b/SparkleLib/SparkleLib.csproj
@@ -46,7 +46,7 @@
-
+
diff --git a/SparkleLib/SparkleRepo.cs b/SparkleLib/SparkleRepo.cs
index 4a00ba84..eda5656b 100644
--- a/SparkleLib/SparkleRepo.cs
+++ b/SparkleLib/SparkleRepo.cs
@@ -117,15 +117,15 @@ namespace SparkleLib {
public event SyncStatusChangedEventHandler SyncStatusChanged;
- public delegate void NewCommitEventHandler (SparkleCommit commit, string repository_path);
- public delegate void ConflictDetectedEventHandler (object o, SparkleEventArgs args);
- public delegate void ChangesDetectedEventHandler (object o, SparkleEventArgs args);
- public delegate void CommitEndedUpEmptyEventHandler (object o, SparkleEventArgs args);
+ public delegate void NewChangeSetEventHandler (SparkleChangeSet change_set, string source_path);
+ public delegate void ConflictResolvedEventHandler ();
+ public delegate void ChangesDetectedEventHandler ();
+ public delegate void CommitEndedUpEmptyEventHandler ();
- public event NewCommitEventHandler NewCommit;
- public event ConflictDetectedEventHandler ConflictDetected;
+ public event NewChangeSetEventHandler NewChangeSet;
+ public event ConflictResolvedEventHandler ConflictResolved;
public event ChangesDetectedEventHandler ChangesDetected;
- public event CommitEndedUpEmptyEventHandler CommitEndedUpEmpty;
+ public event CommitEndedUpEmptyEventHandler CommitEndedUpEmpty; // TODO this thing may be obsolete because of AnyDifferences
public SparkleRepo (string path, SparkleBackend backend)
@@ -348,10 +348,8 @@ namespace SparkleLib {
// Only fire the event if the timer has been stopped.
// This prevents multiple events from being raised whilst "buffering".
if (!this.has_changed) {
- SparkleEventArgs args = new SparkleEventArgs ("ChangesDetected");
-
if (ChangesDetected != null)
- ChangesDetected (this, args);
+ ChangesDetected ();
}
SparkleHelpers.DebugInfo ("Event", "[" + Name + "] " + wct.ToString () + " '" + fse_args.Name + "'");
@@ -382,10 +380,8 @@ namespace SparkleLib {
Push ();
} else {
- SparkleEventArgs args = new SparkleEventArgs ("CommitEndedUpEmpty");
-
if (CommitEndedUpEmpty != null)
- CommitEndedUpEmpty (this, args);
+ CommitEndedUpEmpty ();
}
} finally {
this.remote_timer.Start ();
@@ -560,9 +556,8 @@ namespace SparkleLib {
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Conflict resolved.");
EnableWatching ();
- SparkleEventArgs args = new SparkleEventArgs ("ConflictDetected");
- if (ConflictDetected != null)
- ConflictDetected (this, args);
+ if (ConflictResolved != null)
+ ConflictResolved ();
Push ();
}
@@ -575,8 +570,8 @@ namespace SparkleLib {
this.current_hash = GetCurrentHash ();
- if (NewCommit != null)
- NewCommit (GetCommits (1) [0], LocalPath);
+ if (NewChangeSet != null)
+ NewChangeSet (GetChangeSets (1) [0], LocalPath);
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Changes rebased.");
}
@@ -859,12 +854,12 @@ namespace SparkleLib {
// Returns a list of latest commits
// TODO: Method needs to be made a lot faster
- public List GetCommits (int count)
+ public List GetChangeSets (int count)
{
if (count < 1)
count = 30;
- List commits = new List ();
+ List change_sets = new List ();
SparkleGit git_log = new SparkleGit (LocalPath, "log -" + count + " --raw -M --date=iso");
Console.OutputEncoding = System.Text.Encoding.Unicode;
@@ -922,14 +917,14 @@ namespace SparkleLib {
Match match = regex.Match (log_entry);
if (match.Success) {
- SparkleCommit commit = new SparkleCommit ();
+ SparkleChangeSet change_set = new SparkleChangeSet ();
- commit.Hash = match.Groups [1].Value;
- commit.UserName = match.Groups [2].Value;
- commit.UserEmail = match.Groups [3].Value;
- commit.IsMerge = is_merge_commit;
+ change_set.Hash = match.Groups [1].Value;
+ change_set.UserName = match.Groups [2].Value;
+ change_set.UserEmail = match.Groups [3].Value;
+ change_set.IsMerge = is_merge_commit;
- commit.DateTime = new DateTime (int.Parse (match.Groups [4].Value),
+ change_set.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 [7].Value), int.Parse (match.Groups [8].Value),
int.Parse (match.Groups [9].Value));
@@ -944,27 +939,27 @@ namespace SparkleLib {
string to_file_path;
if (change_type.Equals ("A")) {
- commit.Added.Add (file_path);
+ change_set.Added.Add (file_path);
} else if (change_type.Equals ("M")) {
- commit.Edited.Add (file_path);
+ change_set.Edited.Add (file_path);
} else if (change_type.Equals ("D")) {
- commit.Deleted.Add (file_path);
+ change_set.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);
+ change_set.MovedFrom.Add (file_path);
+ change_set.MovedTo.Add (to_file_path);
}
}
}
- commits.Add (commit);
+ change_sets.Add (change_set);
}
}
- return commits;
+ return change_sets;
}
diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs
index 3709e0d6..64662182 100644
--- a/SparkleShare/SparkleController.cs
+++ b/SparkleShare/SparkleController.cs
@@ -248,14 +248,14 @@ namespace SparkleShare {
}
- public List GetLog (string name)
+ public List GetLog (string name)
{
string path = Path.Combine (SparklePaths.SparklePath, name);
int log_size = 30;
foreach (SparkleRepo repo in Repositories) {
if (repo.LocalPath.Equals (path))
- return repo.GetCommits (log_size);
+ return repo.GetChangeSets (log_size);
}
return null;
@@ -269,30 +269,30 @@ namespace SparkleShare {
public string GetHTMLLog (string name)
{
- List commits = GetLog (name);
- List activity_days = new List ();
+ List change_sets = GetLog (name);
+ List activity_days = new List ();
- if (commits.Count == 0)
+ if (change_sets.Count == 0)
return null;
- foreach (SparkleCommit commit in commits) {
- GetAvatar (commit.UserEmail, 36);
+ foreach (SparkleChangeSet change_set in change_sets) {
+ GetAvatar (change_set.UserEmail, 36);
- bool commit_inserted = false;
+ bool change_set_inserted = false;
foreach (ActivityDay stored_activity_day in activity_days) {
- if (stored_activity_day.DateTime.Year == commit.DateTime.Year &&
- stored_activity_day.DateTime.Month == commit.DateTime.Month &&
- stored_activity_day.DateTime.Day == commit.DateTime.Day) {
+ if (stored_activity_day.DateTime.Year == change_set.DateTime.Year &&
+ stored_activity_day.DateTime.Month == change_set.DateTime.Month &&
+ stored_activity_day.DateTime.Day == change_set.DateTime.Day) {
- stored_activity_day.Add (commit);
- commit_inserted = true;
+ stored_activity_day.Add (change_set);
+ change_set_inserted = true;
break;
}
}
- if (!commit_inserted) {
- ActivityDay activity_day = new ActivityDay (commit.DateTime);
- activity_day.Add (commit);
+ if (!change_set_inserted) {
+ ActivityDay activity_day = new ActivityDay (change_set.DateTime);
+ activity_day.Add (change_set);
activity_days.Add (activity_day);
}
}
@@ -305,7 +305,7 @@ namespace SparkleShare {
foreach (ActivityDay activity_day in activity_days) {
string event_entries = "";
- foreach (SparkleCommit change_set in activity_day) {
+ foreach (SparkleChangeSet change_set in activity_day) {
string event_entry = "";
if (change_set.IsMerge) {
@@ -514,24 +514,24 @@ namespace SparkleShare {
SparkleRepo repo = new SparkleRepo (folder_path, SparkleBackend.DefaultBackend);
- repo.NewCommit += delegate (SparkleCommit commit, string repository_path) {
- string message = FormatMessage (commit);
+ repo.NewChangeSet += delegate (SparkleChangeSet change_set, string repository_path) {
+ string message = FormatMessage (change_set);
if (NotificationRaised != null)
- NotificationRaised (commit.UserName, commit.UserEmail, message, repository_path);
+ NotificationRaised (change_set.UserName, change_set.UserEmail, message, repository_path);
};
- repo.ConflictDetected += delegate {
+ repo.ConflictResolved += delegate {
if (ConflictNotificationRaised != null)
ConflictNotificationRaised ();
};
repo.SyncStatusChanged += delegate (SyncStatus status) {
- if (status == SyncStatus.SyncDownFailed ||
+ if (status == SyncStatus.SyncDownFailed ||
status == SyncStatus.SyncDownFinished ||
- status == SyncStatus.SyncDownStarted ||
- status == SyncStatus.SyncUpFailed ||
- status == SyncStatus.SyncUpFinished ||
+ status == SyncStatus.SyncDownStarted ||
+ status == SyncStatus.SyncUpFailed ||
+ status == SyncStatus.SyncUpFinished ||
status == SyncStatus.SyncUpStarted) {
UpdateState ();
@@ -616,13 +616,13 @@ namespace SparkleShare {
}
- private string FormatMessage (SparkleCommit commit)
+ private string FormatMessage (SparkleChangeSet change_set)
{
string file_name = "";
- string message = null;
+ string message = "";
- if (commit.Added.Count > 0) {
- foreach (string added in commit.Added) {
+ if (change_set.Added.Count > 0) {
+ foreach (string added in change_set.Added) {
file_name = added;
break;
}
@@ -630,8 +630,8 @@ namespace SparkleShare {
message = String.Format (_("added ‘{0}’"), file_name);
}
- if (commit.Edited.Count > 0) {
- foreach (string modified in commit.Edited) {
+ if (change_set.Edited.Count > 0) {
+ foreach (string modified in change_set.Edited) {
file_name = modified;
break;
}
@@ -639,8 +639,8 @@ namespace SparkleShare {
message = String.Format (_("edited ‘{0}’"), file_name);
}
- if (commit.Deleted.Count > 0) {
- foreach (string removed in commit.Deleted) {
+ if (change_set.Deleted.Count > 0) {
+ foreach (string removed in change_set.Deleted) {
file_name = removed;
break;
}
@@ -648,12 +648,13 @@ namespace SparkleShare {
message = String.Format (_("deleted ‘{0}’"), file_name);
}
- int changes_count = (commit.Added.Count +
- commit.Edited.Count +
- commit.Deleted.Count) - 1;
+ int changes_count = (change_set.Added.Count +
+ change_set.Edited.Count +
+ change_set.Deleted.Count) - 1;
if (changes_count > 0)
- message += "" + String.Format (Catalog.GetPluralString(" and {0} more", " and {0} more",changes_count) , changes_count);
+ message += " " + String.Format (Catalog.GetPluralString ("and {0} more", "and {0} more", changes_count),
+ changes_count);
return message;
}
@@ -1123,11 +1124,11 @@ namespace SparkleShare {
}
- public class ChangeSet : SparkleCommit { }
+ public class ChangeSet : SparkleChangeSet { }
- // All commits that happened on a day
- public class ActivityDay : List
+ // All change sets that happened on a day
+ public class ActivityDay : List
{
public DateTime DateTime;