Skip to content
Permalink
Browse files

[JENKINS-41124] Integrates the fixed from cloudbees-folder

  • Loading branch information...
stephenc committed Jan 19, 2017
1 parent c1d037f commit ba727fac801d6d47743277928447ca3c347a1185
@@ -93,7 +93,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>cloudbees-folder</artifactId>
<version>5.17-20170118.174857-4</version>
<version>5.17-20170119.163248-6</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
@@ -24,7 +24,6 @@

package jenkins.branch;

import com.cloudbees.hudson.plugins.folder.AbstractFolder;
import com.cloudbees.hudson.plugins.folder.ChildNameGenerator;
import com.cloudbees.hudson.plugins.folder.FolderIcon;
import com.cloudbees.hudson.plugins.folder.computed.ChildObserver;
@@ -1800,14 +1799,10 @@ public void observe(@NonNull SCMHead head, @NonNull SCMRevision revision) {
listener.getLogger().println("Ignoring duplicate branch project " + rawName);
return;
}
ChildNameGenerator<AbstractFolder<P>, P> childNameGenerator = getDescriptor().<P>childNameGenerator();
ChildNameGenerator.Trace trace = childNameGenerator.beforeCreateItem(
try (ChildNameGenerator.Trace trace = ChildNameGenerator.beforeCreateItem(
MultiBranchProject.this, branch.getEncodedName(), branch.getName()
);
try {
)){
project = _factory.newInstance(branch);
} finally {
childNameGenerator.afterItemCreated(trace);
}
if (!project.getName().equals(encodedName)) {
throw new IllegalStateException(
@@ -35,6 +35,7 @@
import hudson.model.Run;
import hudson.model.TopLevelItem;
import hudson.model.TopLevelItemDescriptor;
import java.io.IOException;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
@@ -266,6 +267,11 @@ public String dirNameFromLegacy(@NonNull MultiBranchProject<P, R> parent, @NonNu
return NameMangler.apply(NameEncoder.decode(legacyDirName));
}

@Override
public void recordLegacyName(MultiBranchProject<P, R> parent, P item, String legacyDirName) throws IOException {
// no-op because we already tracked the name in Branch.getName()
}

}

}
@@ -809,6 +809,12 @@ public String itemNameFromLegacy(@NonNull OrganizationFolder parent, @NonNull St
public String dirNameFromLegacy(@NonNull OrganizationFolder parent, @NonNull String legacyDirName) {
return NameMangler.apply(NameEncoder.decode(legacyDirName));
}

@Override
public void recordLegacyName(OrganizationFolder parent, MultiBranchProject<?, ?> item, String legacyDirName)
throws IOException {
item.addProperty(new ProjectNameProperty(legacyDirName));
}
}

/**
@@ -1167,16 +1173,13 @@ public void complete() throws IllegalStateException, InterruptedException {
listener.getLogger().println("Ignoring duplicate child " + projectName + " named " + folderName);
return;
}
ChildNameGenerator.Trace trace = ChildNameGeneratorImpl.INSTANCE.beforeCreateItem(
OrganizationFolder.this, folderName, projectName
);
MultiBranchProject<?, ?> project;
try {
try (ChildNameGenerator.Trace trace = ChildNameGenerator.beforeCreateItem(
OrganizationFolder.this, folderName, projectName
)) {
project = factory.createNewProject(
OrganizationFolder.this, folderName, sources, attributes, listener
);
} finally {
ChildNameGeneratorImpl.INSTANCE.afterItemCreated(trace);
}
BulkChange bc = new BulkChange(project);
try {

0 comments on commit ba727fa

Please sign in to comment.
You can’t perform that action at this time.