Skip to content

Commit

Permalink
Don't recreate workspace when using Repository Sharing
Browse files Browse the repository at this point in the history
When using Repository Sharing, the working copy is always recloned (from
the slave cache), which can take a long time on large repos.

This fixes the logic used to detect whether a workspace copy can be
reused to support Repository Sharing.

JENKINS-15829
  • Loading branch information
blt04 committed Feb 12, 2014
1 parent 182c495 commit 3173ad4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/java/hudson/plugins/mercurial/MercurialSCM.java
Expand Up @@ -484,15 +484,18 @@ private boolean canReuseWorkspace(FilePath repo,
boolean jobShouldUseSharing, AbstractBuild<?,?> build,
Launcher launcher, BuildListener listener)
throws IOException, InterruptedException {
if (!new FilePath(repo, ".hg/hgrc").exists()) {
return false;
}

boolean jobUsesSharing = new FilePath(repo, ".hg/sharedpath").exists();
if (jobShouldUseSharing != jobUsesSharing) {
return false;
} else if(jobUsesSharing) {
return true;
}

if (!new FilePath(repo, ".hg/hgrc").exists()) {
return false;
}

HgExe hg = new HgExe(findInstallation(getInstallation()), getCredentials(build.getProject()), launcher, build.getBuiltOn(), listener, build.getEnvironment(listener));
try {
String upstream = hg.config(repo, "paths.default");
Expand Down

0 comments on commit 3173ad4

Please sign in to comment.