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>() }); }
private string GetBuildId(IVersionedPackage package) { this._log.Info("Been asked to find the build id in a package: " + package.Id); var found = _buildIdRegex.Match(package.Message); if (found.Success) { var foundGroup = found.Groups["buildid"]; if (foundGroup != null && foundGroup.Success && !string.IsNullOrEmpty(foundGroup.Value)) { this._log.Info("Found the build id: " + foundGroup.Value); return(foundGroup.Value); } } this._log.Info("Couldn't find the build id in package: " + package.Id); return(string.Empty); }
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>() }); }
public bool CanProvideChangeTracking(IVersionedPackage fromPackage) { return(!string.IsNullOrEmpty(GetBuildId(fromPackage))); }
public bool CanProvideChangeTracking(IVersionedPackage fromPackageStub, IVersionedPackage toPackageStub) { return(CanProvideChangeTracking(fromPackageStub) && CanProvideChangeTracking(toPackageStub)); }