提交 3dd5b61e 编写于 作者: K kohsuke

* {@link ISVNAdminAreaFactorySelector} that uses 1.4 compatible workspace for new check out,

 * but still supports 1.5 workspace, if asked to work with it.
 *
 * <p>
 * Since there are many tools out there that still don't support Subversion 1.5 (including
 * all the major Unix distributions that haven't bundled Subversion 1.5), using 1.4 as the
 * default would reduce the likelihood of the user running into "this SVN client can't work
 * with this workspace version..." problem when using other SVN tools.
 *
 * <p>
 * The primary scenario of this is the use of command-line SVN client, either from shell
 * script, Ant, or Maven.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@11187 71c3de6d-444a-0410-be80-ed276b4c234a
上级 70862469
......@@ -29,6 +29,7 @@ import hudson.scm.RepositoryBrowsers;
import hudson.scm.SCM;
import hudson.scm.SCMDescriptor;
import hudson.scm.SCMS;
import hudson.scm.SubversionWorkspaceSelector;
import hudson.search.CollectionSearchIndex;
import hudson.search.SearchIndexBuilder;
import hudson.security.ACL;
......@@ -84,6 +85,7 @@ import org.kohsuke.stapler.StaplerProxy;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.export.Exported;
import org.tmatesoft.svn.core.internal.wc.admin.SVNAdminAreaFactory;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
......@@ -343,6 +345,9 @@ public final class Hudson extends View implements ItemGroup<TopLevelItem>, Node,
LOGGER.log(Level.SEVERE, "Failed to load proxy configuration", e);
}
// do this before we load plugins so that plugins can change the selector.
SVNAdminAreaFactory.setSelector(new SubversionWorkspaceSelector());
// load plugins.
pluginManager = new PluginManager(context);
......
package hudson.scm;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.internal.wc.admin.ISVNAdminAreaFactorySelector;
import org.tmatesoft.svn.core.internal.wc.admin.SVNAdminArea14;
import org.tmatesoft.svn.core.internal.wc.admin.SVNAdminAreaFactory;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
/**
* {@link ISVNAdminAreaFactorySelector} that uses 1.4 compatible workspace for new check out,
* but still supports 1.5 workspace, if asked to work with it.
*
* <p>
* Since there are many tools out there that still don't support Subversion 1.5 (including
* all the major Unix distributions that haven't bundled Subversion 1.5), using 1.4 as the
* default would reduce the likelihood of the user running into "this SVN client can't work
* with this workspace version..." problem when using other SVN tools.
*
* <p>
* The primary scenario of this is the use of command-line SVN client, either from shell
* script, Ant, or Maven.
*
* @author Kohsuke Kawaguchi
*/
public class SubversionWorkspaceSelector implements ISVNAdminAreaFactorySelector {
public SubversionWorkspaceSelector() {
// don't upgrade the workspace.
SVNAdminAreaFactory.setUpgradeEnabled(false);
}
@SuppressWarnings({"cast", "unchecked"})
public Collection getEnabledFactories(File path, Collection factories, boolean writeAccess) throws SVNException {
if(!writeAccess) // for reading, use all our available factories
return factories;
// for writing, use 1.4
Collection<SVNAdminAreaFactory> enabledFactories = new ArrayList<SVNAdminAreaFactory>();
for (SVNAdminAreaFactory factory : (Collection<SVNAdminAreaFactory>)factories)
if (factory.getSupportedVersion() == SVNAdminArea14.WC_FORMAT)
enabledFactories.add(factory);
return enabledFactories;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册