Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Return version history without cloacked paths when listing for build #153

Merged
merged 1 commit into from
Jun 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public List<ChangeSet> checkout(final Server server, final FilePath workspacePat
project.getFiles(normalizedFolder, versionSpecString, useOverwrite);

if (lastBuildVersionSpec != null) {
return project.getVCCHistory(lastBuildVersionSpec, currentBuildVersionSpec, true, Integer.MAX_VALUE);
return project.getDetailedHistoryWithoutCloakedPaths(lastBuildVersionSpec, currentBuildVersionSpec, cloakedPaths);
}

return new ArrayList<ChangeSet>();
Expand Down
4 changes: 4 additions & 0 deletions tfs/src/main/java/hudson/plugins/tfs/model/Project.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ static ChangeSet findLatestUncloakedChangeset(final Collection<String> cloakedPa
public List<ChangeSet> getDetailedHistoryWithoutCloakedPaths(final Calendar fromTimestamp, final Calendar toTimestamp, final Collection<String> cloakedPaths) {
final DateVersionSpec fromVersion = new DateVersionSpec(fromTimestamp);
final DateVersionSpec toVersion = new DateVersionSpec(toTimestamp);
return getDetailedHistoryWithoutCloakedPaths(fromVersion, toVersion, cloakedPaths);
}

public List<ChangeSet> getDetailedHistoryWithoutCloakedPaths(final VersionSpec fromVersion, final VersionSpec toVersion, final Collection<String> cloakedPaths) {
final List<ChangeSet> changeSets = getVCCHistory(fromVersion, toVersion, true, Integer.MAX_VALUE);
final ArrayList<ChangeSet> changeSetNoCloaked = new ArrayList<ChangeSet>();
for (final ChangeSet changeset : changeSets) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,16 +224,16 @@ public void assertDetailedHistoryIsRetrievedInSecondBuild() throws Exception {
when(workspaces.exists("workspace")).thenReturn(true);
when(workspaces.getWorkspace("workspace")).thenReturn(workspace);
when(workspace.getComputer()).thenReturn("LocalComputer");
when(project.getVCCHistory(isA(VersionSpec.class), isA(VersionSpec.class), anyBoolean(), anyInt())).thenReturn(list);
when(project.getDetailedHistoryWithoutCloakedPaths(isA(VersionSpec.class), isA(VersionSpec.class), anyCollection())).thenReturn(list);

CheckoutAction action = new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true, false);
final Calendar startDate = Util.getCalendar(2008, 9, 24);
final Calendar endDate = Util.getCalendar(2008, 10, 24);
List<ChangeSet> actualList = action.checkout(server, hudsonWs, startDate, endDate);
assertSame("The list from the detailed history, was not the same as returned from checkout", list, actualList);
assertEquals("The list from the detailed history, was not the same as returned from checkout", list, actualList);

final DateVersionSpec startDateVersionSpec = new DateVersionSpec(startDate);
verify(project).getVCCHistory(argThat(new DateVersionSpecMatcher(startDateVersionSpec)), isA(VersionSpec.class), eq(true), anyInt());
verify(project).getDetailedHistoryWithoutCloakedPaths(argThat(new DateVersionSpecMatcher(startDateVersionSpec)), isA(VersionSpec.class), eq(EMPTY_CLOAKED_PATHS_LIST));
}

@Test
Expand Down Expand Up @@ -403,21 +403,20 @@ public void assertCheckoutOnlyRetrievesChangesToTheStartTimestampForCurrentBuild
when(workspaces.exists("workspace")).thenReturn(true);
when(workspaces.getWorkspace("workspace")).thenReturn(workspace);
when(workspace.getComputer()).thenReturn("LocalComputer");
when(project.getVCCHistory(isA(VersionSpec.class), isA(VersionSpec.class), anyBoolean(), anyInt())).thenReturn(list);
when(project.getDetailedHistoryWithoutCloakedPaths(isA(VersionSpec.class), isA(VersionSpec.class), anyCollection())).thenReturn(list);

CheckoutAction action = new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true, false);
final Calendar startDate = Util.getCalendar(2008, 9, 24);
final Calendar endDate = Util.getCalendar(2009, 9, 24);
List<ChangeSet> actualList = action.checkout(server, hudsonWs, startDate, endDate);
assertSame("The list from the detailed history, was not the same as returned from checkout", list, actualList);
assertEquals("The list from the detailed history, was not the same as returned from checkout", list, actualList);

final DateVersionSpec startDateVersionSpec = new DateVersionSpec(startDate);
final DateVersionSpec endDateVersionSpec = new DateVersionSpec(endDate);
verify(project).getVCCHistory(
verify(project).getDetailedHistoryWithoutCloakedPaths(
argThat(new DateVersionSpecMatcher(startDateVersionSpec)),
argThat(new DateVersionSpecMatcher(endDateVersionSpec)),
eq(true),
anyInt());
eq(EMPTY_CLOAKED_PATHS_LIST));
verify(project).getFiles(isA(String.class), eq("D2009-09-24T00:00:00Z"), eq(false));
}

Expand Down