开发者

delete .svn files with Phing (or Ant)

How would I script .svn files removal with Phing... I'm trying this target but it doesn't seem to work. My ${site.dir} variable is "./../../.."

 92         <!-- Cleanup the project directory from any junk files: .svn, .hg etc-->
 93         <target name="cleanup">
 94                     <echo msg="Site dir ${site.dir}"/>
 95             <delete>
 96                 <fileset dir="${site.dir}">     
 97                     <include name="*.svn" />        
 98                     <include name="**/*.svn" />     
 99                     <include name="*.hg" />         
100                     <include name="**/*.hg" />      
101                 </fileset>
102             </delete>
103         </target>   

What a开发者_StackOverflow中文版m I doing wrong?


well. this exec calls do the job:

<target name="cleanup">
    <echo msg="Site dir ${site.dir}"/>
    <exec command="find ${site.dir} -name .svn -delete" />
    <exec command="find ${site.dir} -name .hg -delete" />
</target>

However - can someone explain why original script didn't work? thanks!


ok. resolved. apparantly I needed to add trailing slash to indictaed that .svn is a directory. This works:

92         <!-- Cleanup the project directory from any junk files: .svn, .hg etc-->
 93         <target name="cleanup">
 94            <!-- <echo msg="Site dir ${site.dir}"/>
 95             <exec command="find ${site.dir} -name .svn -delete" />
 96             <exec command="find ${site.dir} -name .hg -delete" />
 97             -->
 98             <delete includeemptydirs="true">
 99                 <fileset dir="${site.dir}" defaultexcludes="false" casesensitive="false">
100                     <include name="*.svn/" />
101                     <include name="**/*.svn/" />
102                     <include name="*.hg/" />
103                     <include name="**/*.hg/" />
104                 </fileset>
105             </delete>
106 
107         </target>


Personally, I'd just use the SvnExport (or equivalent) task to make a clean version of your project.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜