Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-15515] prefer workspace changeset before depot changeset
  • Loading branch information
rpetti committed Nov 20, 2012
1 parent 31483f4 commit 840c94c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/main/java/hudson/plugins/perforce/PerforceSCM.java
Expand Up @@ -887,11 +887,16 @@ public boolean checkout(AbstractBuild build, Launcher launcher,
Counter counter = depot.getCounters().getCounter(counterName);
newestChange = counter.getValue();
} else {
//use the latest submitted change from depot
//use the latest submitted change from workspace, or depot
try {
List<Integer> depotChanges = depot.getChanges().getChangeNumbers("//...", 0, 1);
if (depotChanges != null && depotChanges.size() > 0) {
newestChange = depotChanges.get(0);
List<Integer> workspaceChanges = depot.getChanges().getChangeNumbers(p4WorkspacePath, 0, 1);
if (workspaceChanges != null && workspaceChanges.size() > 0) {
newestChange = workspaceChanges.get(0);
} else {
List<Integer> depotChanges = depot.getChanges().getChangeNumbers("//...", 0, 1);
if (depotChanges != null && depotChanges.size() > 0) {
newestChange = depotChanges.get(0);
}
}
} catch (PerforceException e) {
//fall back onto 'change' counter value
Expand Down

0 comments on commit 840c94c

Please sign in to comment.