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

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1555973 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2014-01-06 18:54:50 +00:00
parent 74da7f8e4e
commit 2216123c75
5 changed files with 32 additions and 3 deletions

View File

@ -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();
@ -116,6 +119,24 @@
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();
task.log('Getting all versioned and unversioned files...');

View File

@ -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

View File

@ -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"/>

View File

@ -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"/>

View File

@ -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>