Skip to content

Commit 02d2fcf

Browse files
committed
Merge pull request #41 from jkapica/one-change
Apply "Poll Excludes File(s)" when building changes in sequence.
2 parents 6acaed2 + 0494c9b commit 02d2fcf

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/main/java/hudson/plugins/perforce/PerforceSCM.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -967,8 +967,17 @@ public boolean checkout(AbstractBuild build, Launcher launcher,
967967
// Set newestChange down to the next available changeset if we're building one change at a time
968968
if (oneChangelistOnly && build.getPreviousBuild() != null
969969
&& lastChange > 0 && newestChange > lastChange) {
970-
List<Integer> workspaceChanges = depot.getChanges().getChangeNumbersTo(p4WorkspacePath, lastChange+1);
971-
newestChange = workspaceChanges.get(workspaceChanges.size()-1);
970+
List<Integer> workspaceChanges = depot.getChanges().getChangeNumbersInRange(
971+
p4workspace, lastChange+1, newestChange, viewMask, showIntegChanges);
972+
for (int i = workspaceChanges.size()-1; i >= 0; --i) {
973+
int changeNumber = workspaceChanges.get(i);
974+
Changelist changelist = depot.getChanges().getChangelist(changeNumber, fileLimit);
975+
if (!isChangelistExcluded(changelist, build.getProject(), p4workspace.getViewsAsString(), log)) {
976+
newestChange = changeNumber;
977+
break;
978+
}
979+
log.println("Changelist "+changeNumber+" is composed of file(s) and/or user(s) that are excluded.");
980+
}
972981
log.println("Remaining changes: " + workspaceChanges);
973982
log.println("Building next changeset in sequence: " + newestChange);
974983
}

0 commit comments

Comments
 (0)