private void ClearReportItem(Config.RepoReport repoReportData, Branch sourceBranch)
        {
            var reportItem = repoReportData.branches.FirstOrDefault(x => x.name == sourceBranch.FriendlyName.Split('/').Last());

            if (reportItem != null)
            {
                repoReportData.branches.Remove(reportItem);
            }
        }
        private void RecordConflicts(Config.RepoReport repoReportData, Branch sourceBranch, Branch targetBranch, Commit lastCommit)
        {
            foreach (var conflict in repo.Index.Conflicts)
            {
                Logger.Log("Conflicted on branch " + sourceBranch.FriendlyName + " with branch " + targetBranch.FriendlyName + ": " + conflict.Ancestor.Path);

                RecordConflict(
                    repoReportData,
                    conflict.Ours.Path,
                    sourceBranch.FriendlyName.Split('/').Last(),
                    targetBranch.FriendlyName.Split('/').Last(),
                    lastCommit.Author.Name,
                    lastCommit.Author.When);
            }
        }
        private Config.RepoReport InitializeReportData(Config.Report reportData)
        {
            var repoReportData = reportData.repos.FirstOrDefault(x => x.name == repoConfig.name);

            if (repoReportData == null)
            {
                repoReportData = new Config.RepoReport()
                {
                    name     = repoConfig.name,
                    branches = new List <Config.BranchReport>()
                };

                reportData.repos.Add(repoReportData);
            }

            return(repoReportData);
        }
        private void RecordConflict(
            Config.RepoReport reportData,
            string path,
            string sourceBranch,
            string mergeBranch,
            string mergeAuthor,
            DateTimeOffset mergeDate)
        {
            var reportItem = reportData.branches.FirstOrDefault(x => x.name == sourceBranch);

            if (reportItem == null)
            {
                reportItem = new Config.BranchReport()
                {
                    name = sourceBranch,
                    conflictingBranches = new List <Config.ConflictingBranchReport>()
                };

                reportData.branches.Add(reportItem);
            }

            var conflictBranch = reportItem.conflictingBranches.FirstOrDefault(x => x.name == mergeBranch);

            if (conflictBranch == null)
            {
                conflictBranch = new Config.ConflictingBranchReport()
                {
                    name             = mergeBranch,
                    conflictingPaths = new List <string>()
                };

                reportItem.conflictingBranches.Add(conflictBranch);
            }

            conflictBranch.lastCommitAuthor = mergeAuthor;
            conflictBranch.lastCommitDate   = mergeDate.ToString();
            conflictBranch.conflictingPaths.Add(path);
        }