public IList<PatchFile> GetInteractiveRebasePatchFiles()
{
string todoFile = GetRebaseDir() + "git-rebase-todo";
string[] todoCommits = File.Exists(todoFile) ? File.ReadAllText(todoFile).Trim().Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries) : null;
IList<PatchFile> patchFiles = new List<PatchFile>();
if (todoCommits != null)
{
foreach (string todoCommit in todoCommits)
{
if (todoCommit.StartsWith("#"))
continue;
string[] parts = todoCommit.Split(' ');
if (parts.Length >= 3)
{
string error = string.Empty;
CommitData data = CommitData.GetCommitData(this, parts[1], ref error);
PatchFile nextCommitPatch = new PatchFile();
nextCommitPatch.Author = string.IsNullOrEmpty(error) ? data.Author : error;
nextCommitPatch.Subject = string.IsNullOrEmpty(error) ? data.Body : error;
nextCommitPatch.Name = parts[0];
nextCommitPatch.Date = string.IsNullOrEmpty(error) ? data.CommitDate.LocalDateTime.ToString() : error;
nextCommitPatch.IsNext = patchFiles.Count == 0;
patchFiles.Add(nextCommitPatch);
}
}
}
return patchFiles;
}