Example #1
0
        public ChangeLogCollection GetChanges(IVersionedPackage toPackage, IVersionedProject project)
        {
            this._log.Info("Getting build id for " + toPackage.Id);
            var toBuildId = GetBuildId(toPackage);

            if (!string.IsNullOrEmpty(toBuildId))
            {
                this._log.Info("Build id found for package " + toPackage.Id + ". Fetching build");
                var build = this._webRequestHelper.GetXmlWebRequestWithBasicAuth <ChangeBuilds>(
                    _configuration.ChangeProviderConfiguration.BaseUrl +
                    "/app/rest/builds/?locator=id:" + toBuildId,
                    _configuration.ChangeProviderConfiguration.Username,
                    _configuration.ChangeProviderConfiguration.Password).Builds.FirstOrDefault();

                this._log.Info("Getting latest change for build id" + toBuildId);
                var toBuildChange = GetChangeFromBuildId(toBuildId, build);

                if (toBuildChange != null && build != null)
                {
                    this._log.Info("found the latest change: " + toBuildChange.Id + ", getting change list");
                    var document =
                        this._webRequestHelper.GetXmlWebRequestWithBasicAuth <ChangeList>(
                            _configuration.ChangeProviderConfiguration.BaseUrl +
                            "/app/rest/changes?locator=sinceChange:(id:" + (toBuildChange.Id - 50) + "),buildType:(id:" +
                            build.BuildTypeId + ")",
                            _configuration.ChangeProviderConfiguration.Username,
                            _configuration.ChangeProviderConfiguration.Password);
                    this._log.Info("build found for package " + toPackage.Id);
                    var changes = GetChangeLogChanges(document, toBuildChange);
                    return(new ChangeLogCollection
                    {
                        Project = project,
                        Changes = changes
                    });
                }
                else
                {
                    this._log.Info("couldn't get the latest change for build " + toBuildId);
                }
            }
            else
            {
                this._log.Info("Couldn't find build for " + toPackage.Id);
            }
            return(new ChangeLogCollection
            {
                Project = project,
                Changes = new List <ChangeLogChange>()
            });
        }
Example #2
0
        public ChangeLogCollection GetChanges(IVersionedPackage fromPackage, IVersionedPackage toPackage, IVersionedProject project)
        {
            this._log.Info("Going to get changes between build " + fromPackage.Id + " and " + toPackage.Id + " in project " + project.ProjectId);
            var fromBuildId = GetBuildId(fromPackage);
            var toBuildId   = GetBuildId(toPackage);

            if (!string.IsNullOrEmpty(fromBuildId) && !string.IsNullOrEmpty(toBuildId))
            {
                this._log.Info("Managed to get both build ids from packages. From: " + fromBuildId + " to: " + toBuildId);
                var build   = GetChangeBuild(fromBuildId);
                var toBuild = GetChangeBuild(fromBuildId);

                var fromBuildChange = GetChangeFromBuildId(fromBuildId, build);

                var toBuildChange = GetChangeFromBuildId(toBuildId, toBuild);

                if (toBuildChange != null && fromBuildChange != null && build != null)
                {
                    this._log.Info("Managed to fetch both builds and their latest changes. Going to get the list of changes between builds.");
                    var document =
                        this._webRequestHelper.GetXmlWebRequestWithBasicAuth <ChangeList>(
                            _configuration.ChangeProviderConfiguration.BaseUrl +
                            "/app/rest/changes?locator=sinceChange:(id:" + fromBuildChange.Id + "),buildType:(id:" +
                            build.BuildTypeId + ")",
                            _configuration.ChangeProviderConfiguration.Username,
                            _configuration.ChangeProviderConfiguration.Password);

                    var changes = GetChangeLogChanges(document, toBuildChange);
                    return(new ChangeLogCollection
                    {
                        Project = project,
                        Changes = changes
                    });
                }
            }
            else
            {
                this._log.Info("Couldn't get the build id for the packages");
            }
            return(new ChangeLogCollection
            {
                Project = project,
                Changes = new List <ChangeLogChange>()
            });
        }