六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 54|回复: 0

远离 svn的花花绿绿

[复制链接]

升级  21.33%

20

主题

20

主题

20

主题

秀才

Rank: 2

积分
82
 楼主| 发表于 2013-1-15 02:22:37 | 显示全部楼层 |阅读模式
<strong><div style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff; font-weight: normal; margin: 8px;"> 
<ol style="font-size: 1em; line-height: 1.4em; margin-top: 0px; margin-right: 0px; margin-bottom: 1px; margin-left: 0px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; padding-left: 0px; background-color: #ffffff; color: #2b91af; border: 1px solid #d1d7dc;" class="dp-j"><li style="font-size: 1em; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 38px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; border-left-width: 1px; border-left-style: solid; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px;"><span style="color: #000000;"><span style="color: #7f0055;"><strong>import java.io.File;  import java.util.ArrayList;  import java.util.Collection;    public class CleanSVN {            public static void main(String[] args){                    String testurlString="args[0]";                    System.out.println(clean(testurlString));      }            public static String clean(String url){                    File files=new File(url);                    if(!files.exists())return "no such directory";                    String str[]=files.list();                    for(int i=0;i<str.length;i++){                            String cDIR=url+"\\"+str[i];                            File cstr=new File(cDIR);                            if(cstr.isDirectory()){                  if(str[i].endsWith(".svn")){                      deletedoc(cstr);                  }else{                      clean(cDIR);                  }              }          }          return "all '.svn' is cleaned";      }            public static void deletedoc(File cstr){                    String dir=cstr.getAbsolutePath();                    String[] dirs=cstr.list();                    for(int i=0;i<dirs.length;i++){                            File sFile=new File(dir+"\\"+dirs[i]);                            if(sFile.isDirectory()){                  deletedoc(sFile);              }else{                  System.out.println(dir+"\\"+dirs[i]+"is deleting ****************");                  sFile.delete();              }          }          cstr.delete();      }  }  以上这段代码 清除了 SVN checkout出来的工程中的标记  工程地址由命令行参数 给出
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表