Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r4110 - trunk/svnant: src/main/org/tigris/subversion/svnant src/main/org/tigris/subversion/svnant/commands src/testcases/org/tigris/subversion/svnant test/svn

subclipse
Discussion topic

Back to topic list

svn commit: r4110 - trunk/svnant: src/main/org/tigris/subversion/svnant src/main/org/tigris/subversion/svnant/commands src/testcases/org/tigris/subversion/svnant test/svn

Author jfrank
Full name Joshua Frankamp
Date 2008-11-30 22:42:09 PST
Message Author: jfrank
Date: 2008-11-30 22:42:09-0800
New Revision: 4110

Added:
   trunk/svnant/src/mai​n/org/tigris/subvers​ion/svnant/commands/​Cleanup.java
Modified:
   trunk/svnant/src/mai​n/org/tigris/subvers​ion/svnant/SvnTask.j​ava
   trunk/svnant/src/tes​tcases/org/tigris/su​bversion/svnant/SvnT​est.java
   trunk/svnant/test/svn/build.xml

Log:
adding cleanup task

Modified: trunk/svnant/src/mai​n/org/tigris/subvers​ion/svnant/SvnTask.j​ava
Url: http://subclipse.tig​ris.org/source/brows​e/subclipse/trunk/sv​nant/src/main/org/ti​gris/subversion/svna​nt/SvnTask.java?view​=diff&rev=4110​&p1=trunk/svnant/s​rc/main/org/tigris/s​ubversion/svnant/Svn​Task.java&p2=tru​nk/svnant/src/main/o​rg/tigris/subversion​/svnant/SvnTask.java​&r1=4109&r2=​4110
====================​====================​====================​==================
--- trunk/svnant/src/mai​n/org/tigris/subvers​ion/svnant/SvnTask.j​ava (original)
+++ trunk/svnant/src/mai​n/org/tigris/subvers​ion/svnant/SvnTask.j​ava 2008-11-30 22:42:09-0800
@@ -65,6 +65,7 @@
 import org.tigris.subversio​n.svnant.commands.Ad​d;
 import org.tigris.subversio​n.svnant.commands.Ca​t;
 import org.tigris.subversio​n.svnant.commands.Ch​eckout;
+import org.tigris.subversio​n.svnant.commands.Cl​eanup;
 import org.tigris.subversio​n.svnant.commands.Co​mmit;
 import org.tigris.subversio​n.svnant.commands.Co​py;
 import org.tigris.subversio​n.svnant.commands.Cr​eateRepository;
@@ -229,6 +230,10 @@
         addCommand(a);
     }
 
+ public void addCleanup(Cleanup a) {
+ addCommand(a);
+ }
+
     public void addCommit(Commit a) {
         addCommand(a);
     }

Added: trunk/svnant/src/mai​n/org/tigris/subvers​ion/svnant/commands/​Cleanup.java
Url: http://subclipse.tig​ris.org/source/brows​e/subclipse/trunk/sv​nant/src/main/org/ti​gris/subversion/svna​nt/commands/Cleanup.​java?view=auto&r​ev=4110
====================​====================​====================​==================
--- (empty file)
+++ trunk/svnant/src/mai​n/org/tigris/subvers​ion/svnant/commands/​Cleanup.java 2008-11-30 22:42:09-0800
@@ -0,0 +1,60 @@
+package org.tigris.subversio​n.svnant.commands;
+
+import java.io.File;
+
+import org.tigris.subversio​n.svnant.SvnAntExcep​tion;
+import org.tigris.subversio​n.svnant.SvnAntValid​ationException;
+import org.tigris.subversio​n.svnclientadapter.S​VNClientException;
+
+public class Cleanup extends SvnCommand {
+
+ /** directory to cleanup */
+ private File path = null;
+
+ private boolean failonerror = true;
+
+ @Override
+ public void execute() throws SvnAntException {
+ if (path != null) {
+ if (path.exists()){
+ try {
+ svnClient.cleanup(path);
+ } catch (SVNClientException e) {
+ if (failonerror){
+ throw new SvnAntException(
+ "Can't cleanup directory " + path.getAbsolutePath(),
+ e);
+ }
+ }
+ }else{
+ if (failonerror){
+ throw new SvnAntException(
+ "Directory doesn't exist " + path.getAbsolutePath());
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Sets the destination directory; required
+ * @param path destination directory for cleanup.
+ */
+ public void setDir(File path) {
+ this.path = path;
+ }
+
+ @Override
+ protected void validateAttributes() throws SvnAntValidationException {
+ if (path == null)
+ throw new SvnAntValidationException("dir must be set");
+ }
+
+ /**
+ * @param failonerror the failonerror to set
+ */
+ public void setFailonerror(boolean failonerror) {
+ this.failonerror = failonerror;
+ }
+
+}

Modified: trunk/svnant/src/tes​tcases/org/tigris/su​bversion/svnant/SvnT​est.java
Url: http://subclipse.tig​ris.org/source/brows​e/subclipse/trunk/sv​nant/src/testcases/o​rg/tigris/subversion​/svnant/SvnTest.java​?view=diff&rev=4​110&p1=trunk/svn​ant/src/testcases/or​g/tigris/subversion/​svnant/SvnTest.java​&p2=trunk/svnant/​src/testcases/org/ti​gris/subversion/svna​nt/SvnTest.java&​r1=4109&r2=4110
====================​====================​====================​==================
--- trunk/svnant/src/tes​tcases/org/tigris/su​bversion/svnant/SvnT​est.java (original)
+++ trunk/svnant/src/tes​tcases/org/tigris/su​bversion/svnant/SvnT​est.java 2008-11-30 22:42:09-0800
@@ -104,10 +104,17 @@
         assertEquals('A',mes​sages[0].getChangedP​aths()[0].getAction(​));
     }
 
+
     public void testAddCommit() throws SVNClientException {
        executeTarget("testAddCommit");
        assertTrue(svnClient​.getSingleStatus(new​ File(WORKINGCOPY_DIR​+"/addCommitTest/fil​e0.add")).getLastCha​ngedRevision().getNu​mber() > 0);
     }
+
+ public void testCleanup() throws SVNClientException {
+ executeTarget("testCleanup");
+ assertTrue(!new File(WORKINGCOPY_DIR​+"/.svn/lock").exist​s());
+ }
+
 
     public void testCopy() throws SVNClientException {
         executeTarget("testCopy");

Modified: trunk/svnant/test/svn/build.xml
Url: http://subclipse.tig​ris.org/source/brows​e/subclipse/trunk/sv​nant/test/svn/build.​xml?view=diff&re​v=4110&p1=trunk/​svnant/test/svn/buil​d.xml&p2=trunk/s​vnant/test/svn/build​.xml&r1=4109​&r2=4110
====================​====================​====================​==================
--- trunk/svnant/test/svn/build.xml (original)
+++ trunk/svnant/test/svn/build.xml 2008-11-30 22:42:09-0800
@@ -233,6 +233,13 @@
     </svn>
   </target>
 
+ <target name="testCleanup" depends="init">
+ <echo file="workingcopy/.s​vn/lock">test<​/echo>
+ <svn javahl="${javahl}" svnkit="${svnkit}" username="${username}" password="${password}">
+ <cleanup dir="workingcopy" />
+ </svn>
+ </target>
+
   <target name="testCopy" depends="init">
     <copy todir="workingcopy/c​opyTest">
       <fileset dir="model/copyTest"​></fileset>​

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

svn commit: r4110 - trunk/svnant: src/main/org/tigris/subversion/svnant src/main/org/tigris/subversion/svnant/commands src/testcases/org/tigris/subversion/svnant test/svn jfrank Joshua Frankamp 2008-11-30 22:42:09 PST
Messages per page: