Fix SvnInfo to handle a non-svn workspace: can't deduce the version
available, but it won't stop the build either.
Patch by: mike.aizatsky
Review by: fabbott
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@3717 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/build-tools/ant-gwt/src/com/google/gwt/ant/taskdefs/SvnInfo.java b/build-tools/ant-gwt/src/com/google/gwt/ant/taskdefs/SvnInfo.java
index 2889443..280c200 100644
--- a/build-tools/ant-gwt/src/com/google/gwt/ant/taskdefs/SvnInfo.java
+++ b/build-tools/ant-gwt/src/com/google/gwt/ant/taskdefs/SvnInfo.java
@@ -57,9 +57,20 @@
if (!workDirFile.isDirectory()) {
throw new BuildException(workdir + " is not a directory");
}
+
+ String branch;
+ String revision;
- String branch = getSvnBranch(workDirFile);
- String revision = getSvnVersion(workDirFile);
+ File svnDirFile = new File(workdir, ".svn");
+ if (!svnDirFile.exists()) {
+ // This is not svn workdir. We can't guess the version...
+ branch = "unknown";
+ revision = "unknown";
+ } else {
+ branch = getSvnBranch(workDirFile);
+ revision = getSvnVersion(workDirFile);
+ }
+
getProject().setNewProperty(outprop, branch + "@" + revision);
if (fileprop != null) {
getProject().setNewProperty(fileprop, branch + "-"