[repo][controller] Abstract GetCommits method

This commit is contained in:
Hylke Bons 2010-11-27 17:44:13 +00:00
parent 06001d5893
commit b0f3ae4dc2
3 changed files with 37 additions and 8 deletions

View file

@ -33,14 +33,9 @@ namespace SparkleLib {
public List <string> MovedFrom;
public List <string> MovedTo;
public SparkleCommit (string user_name, string user_email, DateTime date_time, string hash)
public SparkleCommit ()
{
UserName = user_name;
UserEmail = user_email;
DateTime = date_time;
Hash = hash;
Edited = new List <string> ();
Added = new List <string> ();
Deleted = new List <string> ();

View file

@ -971,9 +971,13 @@ namespace SparkleLib {
Commit commit = new Commit (this, commit_ref);
SparkleCommit sparkle_commit = new SparkleCommit (commit.Author.Name, commit.Author.EmailAddress,
commit.CommitDate.DateTime, commit.Hash);
SparkleCommit sparkle_commit = new SparkleCommit ();
sparkle_commit.UserName = commit.Author.Name;
sparkle_commit.UserEmail = commit.Author.EmailAddress;
sparkle_commit.DateTime = commit.CommitDate.DateTime;
sparkle_commit.Hash = commit.Hash;
foreach (Change change in commit.Changes) {
if (change.ChangeType.ToString ().Equals ("Added"))

View file

@ -204,6 +204,31 @@ namespace SparkleShare {
}
public List <ChangeSet> GetLog (string path)
{
int log_size = 30;
List <ChangeSet> list = new List <ChangeSet> ();
foreach (SparkleRepo repo in Repositories) {
if (repo.LocalPath.Equals (path)) {
foreach (SparkleCommit commit in repo.GetCommits (log_size))
list.Add ((ChangeSet) commit);
return list;
}
}
return null;
}
// Creates a folder in the user's home folder to store configuration
private void CreateConfigurationFolders ()
{
@ -826,4 +851,9 @@ namespace SparkleShare {
}
public class ChangeSet : SparkleCommit {
}
}