Skip to content
Snippets Groups Projects
Commit ca3c4d2a authored by brinn's avatar brinn
Browse files

minor: fix formatting

SVN: 4818
parent 1851caf9
No related branches found
No related tags found
No related merge requests found
...@@ -27,39 +27,42 @@ import org.apache.tools.ant.taskdefs.Property; ...@@ -27,39 +27,42 @@ import org.apache.tools.ant.taskdefs.Property;
import ch.systemsx.cisd.ant.task.subversion.SVNItemStatus.StatusFlag; import ch.systemsx.cisd.ant.task.subversion.SVNItemStatus.StatusFlag;
/** /**
*
*
* @author felmer * @author felmer
*/ */
public class GatherRevisionAndVersionTask extends Property public class GatherRevisionAndVersionTask extends Property
{ {
static final String TRUNK_VERSION = "SNAPSHOT"; static final String TRUNK_VERSION = "SNAPSHOT";
private String versionProperty; private String versionProperty;
private String revisionProperty; private String revisionProperty;
private String cleanProperty; private String cleanProperty;
private boolean failOnDirty; private boolean failOnDirty;
private boolean failOnInconsistency; private boolean failOnInconsistency;
public void setFailOnDirty(boolean failOnDirty) public void setFailOnDirty(boolean failOnDirty)
{ {
this.failOnDirty = failOnDirty; this.failOnDirty = failOnDirty;
} }
public void setFailOnInconsistency(boolean failOnInconsistentRevisions) public void setFailOnInconsistency(boolean failOnInconsistentRevisions)
{ {
this.failOnInconsistency = failOnInconsistentRevisions; this.failOnInconsistency = failOnInconsistentRevisions;
} }
public void setRevision(String revisionProperty) public void setRevision(String revisionProperty)
{ {
this.revisionProperty = revisionProperty; this.revisionProperty = revisionProperty;
} }
public void setVersion(String versionProperty) public void setVersion(String versionProperty)
{ {
this.versionProperty = versionProperty; this.versionProperty = versionProperty;
} }
public void setClean(String cleanProperty) public void setClean(String cleanProperty)
{ {
this.cleanProperty = cleanProperty; this.cleanProperty = cleanProperty;
...@@ -120,7 +123,7 @@ public class GatherRevisionAndVersionTask extends Property ...@@ -120,7 +123,7 @@ public class GatherRevisionAndVersionTask extends Property
{ {
return new SVNActions(new AntTaskSimpleLoggerAdapter(this)); return new SVNActions(new AntTaskSimpleLoggerAdapter(this));
} }
/** /**
* <em>Can be overwritten in unit tests.</em> * <em>Can be overwritten in unit tests.</em>
*/ */
...@@ -129,7 +132,7 @@ public class GatherRevisionAndVersionTask extends Property ...@@ -129,7 +132,7 @@ public class GatherRevisionAndVersionTask extends Property
{ {
return new SVNWCProjectPathProvider(baseDir); return new SVNWCProjectPathProvider(baseDir);
} }
/** /**
* <em>Can be overwritten in unit tests.</em> * <em>Can be overwritten in unit tests.</em>
*/ */
...@@ -145,8 +148,6 @@ public class GatherRevisionAndVersionTask extends Property ...@@ -145,8 +148,6 @@ public class GatherRevisionAndVersionTask extends Property
return new SVNDependentProjectsCollector(pathProvider, actions).collectDependentProjectsFromClasspath(); return new SVNDependentProjectsCollector(pathProvider, actions).collectDependentProjectsFromClasspath();
} }
private void setRevisionProperty(int maxLastChangedRevision) private void setRevisionProperty(int maxLastChangedRevision)
{ {
if (revisionProperty != null) if (revisionProperty != null)
...@@ -171,12 +172,12 @@ public class GatherRevisionAndVersionTask extends Property ...@@ -171,12 +172,12 @@ public class GatherRevisionAndVersionTask extends Property
{ {
if (cleanProperty != null) if (cleanProperty != null)
{ {
addProperty(cleanProperty, dirtyProjects.length() == 0 ? "clean": "dirty"); addProperty(cleanProperty, dirtyProjects.length() == 0 ? "clean" : "dirty");
} }
} }
private void checkFailure(HashSet<String> versions, StringBuilder projectRevisions, StringBuilder dirtyProjects, private void checkFailure(HashSet<String> versions, StringBuilder projectRevisions, StringBuilder dirtyProjects,
int minRevision, int maxRevision, int lastChangedRevision) int minRevision, int maxRevision, int lastChangedRevision)
{ {
if (failOnInconsistency && maxRevision != minRevision) if (failOnInconsistency && maxRevision != minRevision)
{ {
...@@ -193,30 +194,29 @@ public class GatherRevisionAndVersionTask extends Property ...@@ -193,30 +194,29 @@ public class GatherRevisionAndVersionTask extends Property
} }
if (maxRevision < lastChangedRevision) if (maxRevision < lastChangedRevision)
{ {
throw new BuildException("Maximum revision < last changed revision: " + maxRevision + " < " throw new BuildException("Maximum revision < last changed revision: " + maxRevision + " < "
+ lastChangedRevision); + lastChangedRevision);
} }
} }
private void addVersion(HashSet<String> versions, SVNInfoRecord info) private void addVersion(HashSet<String> versions, SVNInfoRecord info)
{ {
String repositoryURL = info.getRepositoryUrl(); String repositoryURL = info.getRepositoryUrl();
if (repositoryURL.endsWith("/trunk")) if (repositoryURL.endsWith("/trunk"))
{ {
versions.add(TRUNK_VERSION); versions.add(TRUNK_VERSION);
} else } else
{
int endIndex = repositoryURL.lastIndexOf('/');
if (endIndex >= 0)
{ {
int startIndex = repositoryURL.lastIndexOf('/', endIndex - 1); int endIndex = repositoryURL.lastIndexOf('/');
if (startIndex >= 0) if (endIndex >= 0)
{ {
versions.add(repositoryURL.substring(startIndex + 1, endIndex)); int startIndex = repositoryURL.lastIndexOf('/', endIndex - 1);
} if (startIndex >= 0)
{
versions.add(repositoryURL.substring(startIndex + 1, endIndex));
}
}
} }
}
} }
} }
...@@ -84,7 +84,8 @@ class SVNWCProjectPathProvider implements ISVNProjectPathProvider ...@@ -84,7 +84,8 @@ class SVNWCProjectPathProvider implements ISVNProjectPathProvider
if ('/' == File.separatorChar) if ('/' == File.separatorChar)
{ {
return entityPath.replace('\\', '/'); return entityPath.replace('\\', '/');
} else { } else
{
return entityPath.replace('/', '\\'); return entityPath.replace('/', '\\');
} }
} }
......
...@@ -283,7 +283,8 @@ public class SVNRecursiveCheckoutTaskTest ...@@ -283,7 +283,8 @@ public class SVNRecursiveCheckoutTaskTest
} }
} }
@Test(expectedExceptions={BuildException.class}) @Test(expectedExceptions =
{ BuildException.class })
public void testSetInvalidRevision() public void testSetInvalidRevision()
{ {
SVNRecursiveCheckoutTask task = new SVNRecursiveCheckoutTask(); SVNRecursiveCheckoutTask task = new SVNRecursiveCheckoutTask();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment