Skip to content

Commit

Permalink
Change 'now' to the latest change at the point of sync.
Browse files Browse the repository at this point in the history
JENKINS-36883
  • Loading branch information
p4paul committed Sep 21, 2016
1 parent 148be62 commit 7cef2ca
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 26 deletions.
Expand Up @@ -156,7 +156,7 @@ public void syncFiles(P4Revision buildChange, Populate populate) throws Exceptio
int change = Integer.parseInt(label);
log("P4 Task: label is a number! syncing files at change: " + change);
} catch (NumberFormatException e) {
if (!isLabel(label) && !isClient(label)) {
if (!label.equals("now") && !isLabel(label) && !isClient(label)) {
String msg = "P4: Unable to find client/label: " + label;
log(msg);
logger.warning(msg);
Expand Down
44 changes: 19 additions & 25 deletions src/main/java/org/jenkinsci/plugins/p4/tasks/CheckoutTask.java
@@ -1,12 +1,11 @@
package org.jenkinsci.plugins.p4.tasks;

import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

import com.perforce.p4java.core.IChangelistSummary;
import com.perforce.p4java.impl.generic.core.Label;
import hudson.AbortException;
import hudson.FilePath.FileCallable;
import hudson.remoting.VirtualChannel;
import jenkins.security.Roles;
import org.jenkinsci.plugins.p4.changes.P4ChangeEntry;
import org.jenkinsci.plugins.p4.changes.P4Revision;
import org.jenkinsci.plugins.p4.client.ClientHelper;
Expand All @@ -17,13 +16,12 @@
import org.jenkinsci.remoting.RoleChecker;
import org.jenkinsci.remoting.RoleSensitive;

import com.perforce.p4java.core.IChangelistSummary;
import com.perforce.p4java.impl.generic.core.Label;

import hudson.AbortException;
import hudson.FilePath.FileCallable;
import hudson.remoting.VirtualChannel;
import jenkins.security.Roles;
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

public class CheckoutTask extends AbstractTask implements FileCallable<Boolean>, Serializable {

Expand Down Expand Up @@ -119,7 +117,7 @@ public Object task(ClientHelper p4) throws Exception {
/**
* Get the build status for the parameter map.
*
* @param map
* @param workspace
*/
private CheckoutStatus getStatus(Workspace workspace) {
CheckoutStatus status = CheckoutStatus.HEAD;
Expand All @@ -134,7 +132,7 @@ private CheckoutStatus getStatus(Workspace workspace) {
* Get the sync point from the parameter map. Returns the head if no change
* found in the map.
*
* @param map
* @param workspace
*/
private P4Revision getBuildChange(Workspace workspace) {
// Use head as the default
Expand All @@ -155,10 +153,8 @@ private P4Revision getBuildChange(Workspace workspace) {
build = new P4Revision(change);
logger.info("getBuildChange:pinned:change:" + change);
} catch (NumberFormatException e) {
if (!"now".equals(expandedPopulateLabel)) {
build = new P4Revision(expandedPopulateLabel);
logger.info("getBuildChange:pinned:label:" + expandedPopulateLabel);
}
build = new P4Revision(expandedPopulateLabel);
logger.info("getBuildChange:pinned:label:" + expandedPopulateLabel);
}
}
}
Expand All @@ -183,10 +179,8 @@ private P4Revision getBuildChange(Workspace workspace) {
build = new P4Revision(change);
logger.info("getBuildChange:ReviewProp:LABEL:" + change);
} catch (NumberFormatException e) {
if (!"now".equals(lblStr)) {
build = new P4Revision(lblStr);
logger.info("getBuildChange:ReviewProp:LABEL:" + lblStr);
}
build = new P4Revision(lblStr);
logger.info("getBuildChange:ReviewProp:LABEL:" + lblStr);
}
}

Expand All @@ -197,7 +191,7 @@ private P4Revision getBuildChange(Workspace workspace) {
/**
* Get the unshelve point from the parameter map.
*
* @param map
* @param workspace
*/
private int getReview(Workspace workspace) {
int review = 0;
Expand Down

0 comments on commit 7cef2ca

Please sign in to comment.