fix AddNote, add Note object

This commit is contained in:
Hylke Bons 2011-06-21 19:37:04 +01:00
parent 1d5dd2a8b0
commit a801f68340
2 changed files with 29 additions and 13 deletions

View file

@ -540,25 +540,27 @@ namespace SparkleLib {
public override void AddNote (string revision, string note)
{
string n = Environment.NewLine;
note = "<note>" + n +
" <user>" + n +
" <name>" + SparkleConfig.DefaultConfig.UserName + "</name>" + n +
" <email>" + SparkleConfig.DefaultConfig.UserEmail + "</email>" + n +
" </user>" + n +
" <timestamp>" + (int) (DateTime.UtcNow - new DateTime (1970, 1, 1)).TotalSeconds + "</timestamp>" + n +
" <body>" + note + "</body>" + n +
// Create the note in one line for easier merging
note = "<note>" +
" <user>" +
" <name>" + SparkleConfig.DefaultConfig.UserName + "</name>" +
" <email>" + SparkleConfig.DefaultConfig.UserEmail + "</email>" +
" </user>" +
" <timestamp>" + (int) (DateTime.UtcNow - new DateTime (1970, 1, 1)).TotalSeconds + "</timestamp>" +
" <body>" + note + "</body>" +
"</note>";
SparkleGit git = new SparkleGit (LocalPath, "notes append -m '" + note + "'");
git.Start ();
git.WaitForExit ();
SparkleGit git_notes = new SparkleGit (LocalPath, "notes append -m \"" + note + "\" " + revision);
git_notes.Start ();
git_notes.WaitForExit ();
while (Status != SyncStatus.Idle) {
System.Threading.Thread.Sleep (5 * 20);
}
SyncUp ();
SparkleGit git_push = new SparkleGit (LocalPath, "git push origin refs/notes/*");
git_push.Start ();
git_push.WaitForExit ();
}

View file

@ -24,15 +24,29 @@ namespace SparkleLib {
public string UserName;
public string UserEmail;
public string Folder;
public string Revision;
public DateTime Timestamp;
public bool IsMerge = false;
public bool FolderSupportsNotes = false;
public bool IsMerge = false;
public List<string> Added = new List<string> ();
public List<string> Deleted = new List<string> ();
public List<string> Edited = new List<string> ();
public List<string> MovedFrom = new List<string> ();
public List<string> MovedTo = new List<string> ();
public List<SparkleNote> Notes = new List<SparkleNote> ();
}
public class SparkleNote {
public string UserName;
public string UserEmail;
public DateTime Timestamp;
public string Body;
}
}