コード例 #1
0
        public override Modification[] GetModifications(IIntegrationResult from, IIntegrationResult to)
        {
            if (from == null)
            {
                throw new ArgumentNullException("from");
            }
            if (to == null)
            {
                throw new ArgumentNullException("to");
            }

            var progressInformation = to.BuildProgressInformation;

            progressInformation.SignalStartRunTask("Hg: Get Modifications");

            var lastBuilt = from.GetRevision();
            Log.Debug("Last built from revision '{0}'", lastBuilt);
            var workingDirectory = WorkingDirectoryOrDefault(to.WorkingDirectory);

            progressInformation.AddTaskInformation("Hg: Initializing working directory");
            InitializeWorkingDirectory(workingDirectory);

            var hg = new Hg(new CruiseControlHgProcess(ProcessExecutor), _hgXmlLogParser, workingDirectory);

            progressInformation.AddTaskInformation("Hg: Pulling changes");
            PullChanges(hg);

            progressInformation.AddTaskInformation("Hg: Verifying repository");
            VerifyRepository(hg);

            progressInformation.AddTaskInformation("Hg: Getting target revision");
            var targetRevision = GetTargetRevision(hg);

            progressInformation.AddTaskInformation("Hg: Getting changesets");
            var changesets = GetChangesets(hg, lastBuilt, targetRevision);
            Log.Debug("{0} Hg changeset(s) found", changesets.Count());

            to.SetRevision(targetRevision);

            progressInformation.AddTaskInformation("Hg: Generating modifications");
            return ConvertChangesetsToModifications(changesets)
                .TapIf(() => WebUrlBuilder != null, ems => WebUrlBuilder.SetupModification(ems))
                .Tap(FillIssueUrl);
        }