Skip to content
Permalink
Browse files

[FIXED JENKINS-15132] Don't add '-d' flag on checkout if module name …

…is not over-ridden
  • Loading branch information...
mc1arke committed Oct 14, 2012
1 parent 1f88112 commit 4822c4fbb2f1be2bcadd8853713f87d433ecbc84
Showing with 12 additions and 8 deletions.
  1. +7 −7 src/main/java/hudson/scm/AbstractCvs.java
  2. +5 −1 src/main/java/hudson/scm/CvsModule.java
@@ -68,7 +68,7 @@ public AbstractCvsDescriptor getDescriptor() {
}


protected boolean checkout(CvsRepository[] repositories, boolean flatten, FilePath workspace, boolean canUseUpdate,
protected boolean checkout(CvsRepository[] repositories, boolean isFlatten, FilePath workspace, boolean canUseUpdate,
AbstractBuild<?, ?> build, String dateStamp, boolean pruneEmptyDirectories,
boolean cleanOnFailedUpdate, BuildListener listener) throws IOException, InterruptedException {

@@ -80,9 +80,11 @@ protected boolean checkout(CvsRepository[] repositories, boolean flatten, FilePa

for (CvsModule cvsModule : item.getModules()) {
final String checkoutName = envVars.expand(cvsModule.getCheckoutName());
boolean localSubModule = checkoutName.contains("/");
boolean localSubModule = checkoutName.contains("/") && cvsModule.isAlternativeCheckoutName();
int lastSlash = checkoutName.lastIndexOf("/");

final boolean flatten = isFlatten && !cvsModule.isAlternativeCheckoutName();

final FilePath targetWorkspace = flatten ? workspace.getParent() :
localSubModule ? workspace.child(checkoutName.substring(0, lastSlash)) : workspace;

@@ -149,10 +151,6 @@ protected boolean checkout(CvsRepository[] repositories, boolean flatten, FilePa
// we're doing a checkout
if (!update || (updateFailed && cleanOnFailedUpdate)) {

if (!module.exists()) {
module.mkdirs();
}

if (updateFailed) {
listener.getLogger().println("Update failed. Cleaning workspace and performing full checkout");
workspace.deleteContents();
@@ -181,7 +179,9 @@ protected boolean checkout(CvsRepository[] repositories, boolean flatten, FilePa
checkoutCommand.setPruneDirectories(pruneEmptyDirectories);

// set where we're checking out to
checkoutCommand.setCheckoutDirectory(moduleName);
if (cvsModule.isAlternativeCheckoutName() || flatten) {
checkoutCommand.setCheckoutDirectory(moduleName);
}

// and specify which module to load
checkoutCommand.setModule(envVars.expand(cvsModule.getRemoteName()));
@@ -92,7 +92,11 @@ public CvsModuleLocation getModuleLocation() {
* file-system
*/
public String getCheckoutName() {
return "".equals(Util.fixNull(localName)) ? remoteName : localName;
return isAlternativeCheckoutName()? localName : remoteName;
}

public boolean isAlternativeCheckoutName() {
return !"".equals(Util.fixNull(localName));
}

@Override

0 comments on commit 4822c4f

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