Added clean up of files if clone fails midpart.
authorJohan Groth <johang@symbian.org>
Tue, 13 Jul 2010 15:26:50 +0100
changeset 78 b9933b133306
parent 77 bde272fb9ff9
child 79 c60c76df3628
Added clean up of files if clone fails midpart.
bootstrap.xml
--- a/bootstrap.xml	Mon Jun 14 16:03:06 2010 +0100
+++ b/bootstrap.xml	Tue Jul 13 15:26:50 2010 +0100
@@ -108,12 +108,38 @@
           </then>
           <else>
             <echo message="Cloning ${repo.url}#${repo.rev} to ${sf.target.dir}/${subdir.name}"/>
-            <exec executable="hg" dir="${sf.target.dir}">
-              <arg value="clone"/>
-              <arg value="-r${repo.rev}"/>
-              <arg value="${repo.url}"/>
-              <arg value="${subdir.name}"/>
-            </exec>
+		<trycatch>
+                <try>
+	            <exec executable="hg" dir="${sf.target.dir}">
+      	        <arg value="clone"/>
+            	  <arg value="-r${repo.rev}"/>
+              	  <arg value="${repo.url}"/>
+              	  <arg value="${subdir.name}"/>
+                  </exec>
+                </try>
+                <catch>
+                  <delete dir="${sf.target.dir}/${subdir.name}"/>
+			<trycatch>
+                	  <try>  
+	                <exec executable="hg" dir="${sf.target.dir}">
+      	            <arg value="clone"/>
+            	      <arg value="-r${repo.rev}"/>
+              	      <arg value="${repo.url}"/>
+              	      <arg value="${subdir.name}"/>
+                      </exec>
+                    </try>
+                    <catch>
+                      <delete dir="${sf.target.dir}/${subdir.name}"/>
+                      <exec executable="hg" dir="${sf.target.dir}">
+                         <arg value="clone"/>
+                         <arg value="-r${repo.rev}"/>
+                         <arg value="${repo.url}"/>
+                         <arg value="${subdir.name}"/>
+                      </exec>
+                    </catch>
+                  </trycatch>
+                </catch>
+            </trycatch>
           </else>
         </if>
       </else>