diff --git a/tfs/src/main/java/hudson/plugins/tfs/actions/CheckoutAction.java b/tfs/src/main/java/hudson/plugins/tfs/actions/CheckoutAction.java index e92b426bc..a4f2ecc37 100644 --- a/tfs/src/main/java/hudson/plugins/tfs/actions/CheckoutAction.java +++ b/tfs/src/main/java/hudson/plugins/tfs/actions/CheckoutAction.java @@ -62,7 +62,7 @@ public List 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(); diff --git a/tfs/src/main/java/hudson/plugins/tfs/model/Project.java b/tfs/src/main/java/hudson/plugins/tfs/model/Project.java index 8f81ffde5..d34fe7b1e 100644 --- a/tfs/src/main/java/hudson/plugins/tfs/model/Project.java +++ b/tfs/src/main/java/hudson/plugins/tfs/model/Project.java @@ -217,6 +217,10 @@ static ChangeSet findLatestUncloakedChangeset(final Collection cloakedPa public List getDetailedHistoryWithoutCloakedPaths(final Calendar fromTimestamp, final Calendar toTimestamp, final Collection cloakedPaths) { final DateVersionSpec fromVersion = new DateVersionSpec(fromTimestamp); final DateVersionSpec toVersion = new DateVersionSpec(toTimestamp); + return getDetailedHistoryWithoutCloakedPaths(fromVersion, toVersion, cloakedPaths); + } + + public List getDetailedHistoryWithoutCloakedPaths(final VersionSpec fromVersion, final VersionSpec toVersion, final Collection cloakedPaths) { final List changeSets = getVCCHistory(fromVersion, toVersion, true, Integer.MAX_VALUE); final ArrayList changeSetNoCloaked = new ArrayList(); for (final ChangeSet changeset : changeSets) { diff --git a/tfs/src/test/java/hudson/plugins/tfs/actions/CheckoutActionTest.java b/tfs/src/test/java/hudson/plugins/tfs/actions/CheckoutActionTest.java index 51a3173a6..b18418f66 100644 --- a/tfs/src/test/java/hudson/plugins/tfs/actions/CheckoutActionTest.java +++ b/tfs/src/test/java/hudson/plugins/tfs/actions/CheckoutActionTest.java @@ -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 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 @@ -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 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)); }