Merge remote-tracking branch 'upstream/master' into windows

This commit is contained in:
wimh 2011-07-22 20:27:59 +02:00
commit 0862fa2a72
4 changed files with 51 additions and 7 deletions

5
NEWS
View file

@ -3,8 +3,9 @@
Hylke: Reimplement notes to be less buggy and backend independent. Polish Hylke: Reimplement notes to be less buggy and backend independent. Polish
about dialog and event log html. Fix a bug where large collections of files about dialog and event log html. Fix a bug where large collections of files
weren't being synced when adding them at the same time. The event log now weren't being synced when adding them at the same time. The event log now
collapses huge change sets. Add a controller per UI component to make the collapses huge change sets and squashes events together by day when they
Windows verion easier to implement. are on the same day and in the same folder. Add a controller per UI component
to make the Windows verion easier to implement.
0.2.4 for Linux and Mac (Wed Jun 29, 2011): 0.2.4 for Linux and Mac (Wed Jun 29, 2011):

View file

@ -28,6 +28,7 @@ namespace SparkleLib {
public string Folder; public string Folder;
public string Revision; public string Revision;
public DateTime Timestamp; public DateTime Timestamp;
public DateTime FirstTimestamp;
public bool IsMerge = false; public bool IsMerge = false;
public List<string> Added = new List<string> (); public List<string> Added = new List<string> ();

View file

@ -210,7 +210,7 @@ namespace SparkleShare {
if (match.Success) { if (match.Success) {
string folder_name = match.Groups [1].Value; string folder_name = match.Groups [1].Value;
string revision = match.Groups [2].Value; string revision = match.Groups [2].Value;
string note = match.Groups [3].Value.Replace ("%20", " "); string note = match.Groups [3].Value;
Thread thread = new Thread (new ThreadStart (delegate { Thread thread = new Thread (new ThreadStart (delegate {
SparkleShare.Controller.AddNoteToFolder (folder_name, revision, note); SparkleShare.Controller.AddNoteToFolder (folder_name, revision, note);

View file

@ -297,7 +297,39 @@ namespace SparkleShare {
stored_activity_day.DateTime.Month == change_set.Timestamp.Month && stored_activity_day.DateTime.Month == change_set.Timestamp.Month &&
stored_activity_day.DateTime.Day == change_set.Timestamp.Day) { stored_activity_day.DateTime.Day == change_set.Timestamp.Day) {
bool squash = false;
foreach (SparkleChangeSet existing_set in stored_activity_day) {
if (change_set.UserName.Equals (existing_set.UserName) &&
change_set.UserEmail.Equals (existing_set.UserEmail) &&
change_set.Folder.Equals (existing_set.Folder)) {
existing_set.Added.AddRange (change_set.Added);
existing_set.Edited.AddRange (change_set.Edited);
existing_set.Deleted.AddRange (change_set.Deleted);
existing_set.MovedFrom.AddRange (change_set.MovedFrom);
existing_set.MovedTo.AddRange (change_set.MovedTo);
existing_set.Notes.AddRange (change_set.Notes);
existing_set.Added = existing_set.Added.Distinct ().ToList ();
existing_set.Edited = existing_set.Edited.Distinct ().ToList ();
existing_set.Deleted = existing_set.Deleted.Distinct ().ToList ();
if (DateTime.Compare (existing_set.Timestamp, change_set.Timestamp) < 1) {
existing_set.FirstTimestamp = existing_set.Timestamp;
existing_set.Timestamp = change_set.Timestamp;
existing_set.Revision = change_set.Revision;
} else {
existing_set.FirstTimestamp = change_set.Timestamp;
}
squash = true;
}
}
if (!squash)
stored_activity_day.Add (change_set); stored_activity_day.Add (change_set);
change_set_inserted = true; change_set_inserted = true;
break; break;
} }
@ -412,10 +444,17 @@ namespace SparkleShare {
avatar_email = change_set.UserEmail; avatar_email = change_set.UserEmail;
event_entry += "</dl>"; event_entry += "</dl>";
string timestamp = change_set.Timestamp.ToString ("H:mm");
if (!change_set.FirstTimestamp.Equals (new DateTime ()))
timestamp = change_set.FirstTimestamp.ToString ("H:mm") +
" " + timestamp;
event_entries += event_entry_html.Replace ("<!-- $event-entry-content -->", event_entry) event_entries += event_entry_html.Replace ("<!-- $event-entry-content -->", event_entry)
.Replace ("<!-- $event-user-name -->", change_set.UserName) .Replace ("<!-- $event-user-name -->", change_set.UserName)
.Replace ("<!-- $event-avatar-url -->", "file://" + GetAvatar (avatar_email, 48)) .Replace ("<!-- $event-avatar-url -->", "file://" + GetAvatar (avatar_email, 48))
.Replace ("<!-- $event-time -->", change_set.Timestamp.ToString ("H:mm")) .Replace ("<!-- $event-time -->", timestamp)
.Replace ("<!-- $event-folder -->", change_set.Folder) .Replace ("<!-- $event-folder -->", change_set.Folder)
.Replace ("<!-- $event-revision -->", change_set.Revision) .Replace ("<!-- $event-revision -->", change_set.Revision)
.Replace ("<!-- $event-folder-color -->", AssignColor (change_set.Folder)) .Replace ("<!-- $event-folder-color -->", AssignColor (change_set.Folder))
@ -688,7 +727,7 @@ namespace SparkleShare {
} }
return message; return message;
} } // TODO: move to bubbles controller
// Recursively gets a folder's size in bytes // Recursively gets a folder's size in bytes
@ -1055,6 +1094,9 @@ namespace SparkleShare {
public void AddNoteToFolder (string folder_name, string revision, string note) public void AddNoteToFolder (string folder_name, string revision, string note)
{ {
folder_name = folder_name.Replace ("%20", " ");
note = note.Replace ("%20", " ");
foreach (SparkleRepoBase repo in Repositories) { foreach (SparkleRepoBase repo in Repositories) {
if (repo.Name.Equals (folder_name)) if (repo.Name.Equals (folder_name))
repo.AddNote (revision, note); repo.AddNote (revision, note);