Skip to content

Apache Lucene open-source search software

LUCENE-5385: Make precommit work for svn 1.8 or git checkouts

Uwe Schindler2216123c7503
diff --git a/extra-targets.xml b/extra-targets.xml
index cdf861df86e..b71b64c84c3 100644
--- a/extra-targets.xml
+++ b/extra-targets.xml
@@ -105,6 +105,9 @@
<groovy taskname="svn" classpathref="svnkit.classpath"><![CDATA[
import org.tmatesoft.svn.core.*;
import org.tmatesoft.svn.core.wc.*;
+ import org.apache.tools.ant.Project;
+
+ def RECOMMENDED_SVNKIT_18 = '1.8.2';
SVNClientManager manager = SVNClientManager.newInstance();
SVNStatusClient statusClient = manager.getStatusClient();
@@ -115,6 +118,24 @@
def convertRelative = {
file -> '.' + file.getAbsolutePath().substring(baseLen).replace(File.separatorChar, (char)'/');
}
+
+ // do some fake check, to verify if this is valid SVN working copy. If this fails ignore checks but log some useful message.
+ try {
+ statusClient.doStatus(basedir, false);
+ } catch (SVNException ex) {
+ int code = ex.getErrorMessage().getErrorCode().getCode();
+ if (code == SVNErrorCode.WC_UNSUPPORTED_FORMAT.getCode()) {
+ task.log('WARNING: Unsupported SVN working copy version! Disabling checks...', Project.MSG_WARN);
+ task.log('If your working copy is on version 1.8 already, please pass -Dsvnkit.version=' + RECOMMENDED_SVNKIT_18 + ' to successfully run checks.', Project.MSG_INFO);
+ return;
+ } else if (code == SVNErrorCode.WC_NOT_DIRECTORY.getCode() || code == SVNErrorCode.WC_NOT_FILE.getCode()) {
+ task.log('WARNING: Development directory is not an SVN checkout! Disabling checks...', Project.MSG_WARN);
+ return;
+ } else {
+ task.log('WARNING: Development directory is not a valid SVN checkout (' + ex.getErrorMessage() + '). Disabling checks...', Project.MSG_WARN);
+ return;
+ }
+ }
Set missingProps = new TreeSet(), unversioned = new TreeSet(), changed = new TreeSet();
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index c56cd31636c..3b6236d08b9 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -109,6 +109,11 @@ Build
* SOLR-5590: Upgrade HttpClient/HttpComponents to 4.3.x.
(Karl Wright via Shawn Heisey)
+* LUCENE-5385: "ant precommit" / "ant check-svn-working-copy" now work
+ for SVN 1.8 or GIT checkouts. The ANT target prints a warning instead
+ of failing. It also instructs the user, how to run on SVN 1.8 working
+ copies. (Robert Muir, Uwe Schindler)
+
Bug fixes
* LUCENE-5285: Improved highlighting of multi-valued fields with
diff --git a/lucene/test-framework/build.xml b/lucene/test-framework/build.xml
index eaa3d3701d4..a4abbe608b1 100644
--- a/lucene/test-framework/build.xml
+++ b/lucene/test-framework/build.xml
@@ -27,8 +27,7 @@
<path id="classpath">
<pathelement location="${common.dir}/build/core/classes/java"/>
<pathelement location="${common.dir}/build/codecs/classes/java"/>
- <path refid="junit-path"/>
- <path refid="ant-path"/>
+ <fileset dir="lib"/>
</path>
<path id="test.classpath"/>
diff --git a/lucene/tools/build.xml b/lucene/tools/build.xml
index 3a3e3d4071e..4eed862d6a5 100644
--- a/lucene/tools/build.xml
+++ b/lucene/tools/build.xml
@@ -28,7 +28,7 @@
<path id="classpath">
<!-- TODO: we need this for forbidden-apis to be happy, because it does not support "includeantruntime": -->
- <path refid="ant-path"/>
+ <fileset dir="lib"/>
</path>
<path id="test.classpath"/>
diff --git a/lucene/tools/ivy.xml b/lucene/tools/ivy.xml
index 6525f67f041..6b8cafbe059 100644
--- a/lucene/tools/ivy.xml
+++ b/lucene/tools/ivy.xml
@@ -18,4 +18,8 @@
-->
<ivy-module version="2.0">
<info organisation="org.apache.lucene" module="core-tools"/>
+ <dependencies>
+ <dependency org="org.apache.ant" name="ant" rev="${/org.apache.ant/ant}" transitive="false" />
+ <exclude org="*" ext="*" matcher="regexp" type="${ivy.exclude.types}"/>
+ </dependencies>
</ivy-module>