private MyChangeset GetCommentsForBuild(MyTfsBuildDefinition buildDefinition, BuildStatus buildStatus) { var newBuildHash = buildStatus.GetBuildDataAsHash(); CommentAndHash cachedChangeset; bool haveEverGottenCommentsForThisBuildDef = CachedCommentsByBuildDefinition.TryGetValue(buildDefinition.Name, out cachedChangeset); bool areCacheCommentsStale = false; if (haveEverGottenCommentsForThisBuildDef) { string oldBuildHash = cachedChangeset.BuildStatusHash; areCacheCommentsStale = oldBuildHash != newBuildHash; } if (!haveEverGottenCommentsForThisBuildDef || areCacheCommentsStale) { MyChangeset latestChangeset = buildDefinition.GetLatestChangeset(); CachedCommentsByBuildDefinition[buildDefinition.Name] = new CommentAndHash(newBuildHash, latestChangeset); } return CachedCommentsByBuildDefinition[buildDefinition.Name].Changeset; }
private MyChangeset GetCommentsForBuild(MyTfsBuildDefinition buildDefinition, BuildStatus buildStatus) { var newBuildHash = buildStatus.GetBuildDataAsHash(); CommentAndHash cachedChangeset; bool haveEverGottenCommentsForThisBuildDef = CachedCommentsByBuildDefinition.TryGetValue(buildDefinition.Name, out cachedChangeset); bool areCacheCommentsStale = false; if (haveEverGottenCommentsForThisBuildDef) { string oldBuildHash = cachedChangeset.BuildStatusHash; areCacheCommentsStale = oldBuildHash != newBuildHash; } if (!haveEverGottenCommentsForThisBuildDef || areCacheCommentsStale) { MyChangeset latestChangeset = buildDefinition.GetLatestChangeset(); CachedCommentsByBuildDefinition[buildDefinition.Name] = new CommentAndHash(newBuildHash, latestChangeset); } return(CachedCommentsByBuildDefinition[buildDefinition.Name].Changeset); }