Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-11677] only use the label field if the parameters in it reso…
…lve to something non-empty
  • Loading branch information
rpetti committed Nov 10, 2011
1 parent 269c541 commit 49901db
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main/java/hudson/plugins/perforce/PerforceSCM.java
Expand Up @@ -599,8 +599,8 @@ public boolean checkout(AbstractBuild build, Launcher launcher,
if(!disableAutoSync)
{
List<Changelist> changes;
if (p4Label != null) {
newestChange = depot.getChanges().getHighestLabelChangeNumber(p4workspace, p4Label, p4WorkspacePath);
if (p4Label != null && !p4Label.trim().isEmpty()) {
newestChange = depot.getChanges().getHighestLabelChangeNumber(p4workspace, p4Label.trim(), p4WorkspacePath);
} else {
String counterName;
if (p4Counter != null && !updateCounterValue)
Expand Down Expand Up @@ -653,7 +653,7 @@ public boolean checkout(AbstractBuild build, Launcher launcher,
StringBuilder sbSyncPathSuffix = new StringBuilder();
sbSyncPathSuffix.append("@");

if (p4Label != null) {
if (p4Label != null && !p4Label.trim().isEmpty()) {
sbMessage.append("label ");
sbMessage.append(p4Label);
sbSyncPathSuffix.append(p4Label);
Expand Down Expand Up @@ -949,10 +949,11 @@ private SCMRevisionState getCurrentDepotRevisionState(Workspace p4workspace, Abs
// by this workspace).

Integer newestChange;
if (p4Label != null) {
String p4Label = substituteParameters(this.p4Label, getDefaultSubstitutions(project));
if (p4Label != null && !p4Label.trim().isEmpty()) {
//In case where we are using a rolling label.
String root = "//" + p4workspace.getName() + "/...";
newestChange = depot.getChanges().getHighestLabelChangeNumber(p4workspace, substituteParameters(p4Label, getDefaultSubstitutions(project)), root);
newestChange = depot.getChanges().getHighestLabelChangeNumber(p4workspace, p4Label.trim(), root);
} else {
Counter counter = depot.getCounters().getCounter("change");
newestChange = counter.getValue();
Expand Down

0 comments on commit 49901db

Please sign in to comment.