zoukankan      html  css  js  c++  java
  • SVN 创建分支

    2种方法:

    创建分支之前一定要先更新到最新版本号。

    1.你用tortoiseSVN点版本号库浏览,在须要建立分支的路径(比方trunk)点copy to + 新分支名称(注意:必须与trunk不能同名,你能够新建一个名称比方branch),然后在分支文件夹的根文件夹update。

    2.tortoiseSVN点版本号库浏览,你在须要创建的路径下右键tortoiseSVN 选择create folder 然后创建新路径名称(目录)然后把主干或者其它分支路径的代码(拉分支这样的情况预计想并行开发)导入到这个路径下就能够了。然后在分支目录的根目录update。

    创建分支是否成功,在分支目录里面 TortoiseSVN  ---->版本号库浏览器  定位的是分支路径那就对了。假设还是主干路径那创建分支就有问题了。

    注意:1、假设分支文件夹在没有分支的情况下check out下来的项目,这时候工作副本相应版本号库的路径仍为原来相应的主干的文件夹。所以在client文本夹中删除之后 再从serverUpdate分支的项目。不能用clientSVN delete。这样会删除主干上的项目。


    2、假设是多个项目,仅仅保留几个项目做分支。那就从版本号浏览器中分支的项目右键删除,不能从本地svn delete。这样会删除主干上的项目。


    改动相关文件项目名,这样就能引入eclipse 了

    /gjmj/mallv2/branchs/gjmj_20141110/shop/.classpath
    /gjmj/mallv2/branchs/gjmj_20141110/shop/.project
    /gjmj/mallv2/branchs/gjmj_20141110/shop/WebRoot/WEB-INF/web.xml
    /gjmj/mallv2/branchs/gjmj_20141110/shop/config/boot.xml
    /gjmj/mallv2/branchs/gjmj_20141110/shop/config/ui/path.xml


    以下修改相关文件项目名的代码依据详细须要修改

    import java.io.BufferedReader;
    
    import java.io.BufferedWriter;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStreamReader;
    import java.io.OutputStreamWriter;
    import java.io.PrintWriter;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.Iterator;
    import java.util.List;
    import java.util.Map;
    import java.util.Set;
    
    
    /**
     * 1、改动多个项目的路径,以便导入eclipse
     * 2、所有替换gjmj_20141110为分支目录
     * @author Coco
     *
     */
    public class FileContentReplace {
     private static String REPLACE_SRC_FILE = "E:\workspaces\gjmj\mallv2\branchs\gjmj_20141110";
     private static String REPLACE_EXCLUDE_FILE = "E:\Workspaces\gjmj\mallv2\branchs\gjmj_20141110\core\WebRoot\sr;E:\Workspaces\gjmj\mallv2\branchs\gjmj_20141110\core\WebRoot\upload;E:\Workspaces\gjmj\mallv2\branchs\gjmj_20141110\core\WebRoot\WEB-INF\lib;toruk.xml";
     
     private static String REPLACE_CONTENT = "gjmj_mallv2->gjmj_20141110;E:/Workspaces/gjmj/mallv2/project/->E:/Workspaces/gjmj/mallv2/branchs/gjmj_20141110/;E:/workspaces/gjmj/mallv2/project/->E:/workspaces/gjmj/mallv2/branchs/gjmj_20141110/";
     
     public static List<String> EXCLUDE_FILE_LIST = null;
     
     public static Map<String,String> getReplaceMaping()  {
       Map<String,String> map = new HashMap<String,String>();
       if(REPLACE_CONTENT!=null){
         String[] repContentArr = REPLACE_CONTENT.split(";");
         for(String repMap:repContentArr){
           String[] arg = repMap.split("->");
           if(arg.length!=2){
             throw new RuntimeException(repMap+"不对");
           }else{
             map.put(arg[0], arg[1]);
           }
         }
       }
       return map;
     }
     
     public static List<String> excludeFileList(){
       if(EXCLUDE_FILE_LIST==null){
         EXCLUDE_FILE_LIST = new ArrayList<String>();
         if(REPLACE_EXCLUDE_FILE!=null){
           String[] strArr = REPLACE_EXCLUDE_FILE.split(";");
           for(String str:strArr){
             EXCLUDE_FILE_LIST.add(str.trim());
           }
         }
         return EXCLUDE_FILE_LIST;
       }else{
        return EXCLUDE_FILE_LIST;
       }
     }
     public static void handFile(File infile,String fromCharSet,String toCharSet) throws Exception{
          if(infile.getName().equals(".svn")){
            return;
          }
          if(infile.getName().contains("!")){
            return;
          }
          for(String excludeFile:excludeFileList()){
            if(infile.getPath().toLowerCase().contains(excludeFile.toLowerCase())||infile.getName().equals(excludeFile)){
              return;
            }
          }
          
          BufferedReader in = new BufferedReader(new InputStreamReader(
          new FileInputStream(infile), fromCharSet));
          String reading;
          String  content = "";
          while ((reading = in.readLine()) != null) {
            content +=reading+"
    ";
          }
          boolean flag = false;
          Map<String,String> replaceMapping = getReplaceMaping();
          if(replaceMapping!=null){
            Set<Map.Entry<String, String>> replaceEntrys =   replaceMapping.entrySet();
            for(Iterator<Map.Entry<String, String>> it = replaceEntrys.iterator();it.hasNext();){
              Map.Entry<String, String> entry = it.next();
              String key = entry.getKey();
              if(content.contains(key)){
                flag = true;
              }
            }
          }
          
          if(flag){
            File outfile = new File(infile + ".tmp");
            PrintWriter out = new PrintWriter(new BufferedWriter(
            new OutputStreamWriter(new FileOutputStream(outfile), toCharSet)));
            
            if(replaceMapping!=null){
              Set<Map.Entry<String, String>> replaceEntrys =   replaceMapping.entrySet();
              for(Iterator<Map.Entry<String, String>> it = replaceEntrys.iterator();it.hasNext();){
                Map.Entry<String, String> entry = it.next();
                String key = entry.getKey();
                String value = entry.getValue();
                content = content.replaceAll(key, value);
              }
              System.out.println("替换文件:"+infile.getPath());
            }
            
            out.println(content);
            out.flush();
            out.close();
            in.close();
            infile.delete();
            outfile.renameTo(infile);
          }else{
            in.close();
          }
          
        
      }
     
     
     
      public static void main(String[] args) throws Exception {
         replaceFile(new File(REPLACE_SRC_FILE),"UTF-8","UTF-8");
      }
    
    
      public static void replaceFile(File filePath,String fromCharSet,String toCharSet) throws Exception{
        if(filePath.exists()==false){
          new RuntimeException(filePath.getPath()+"不存在");
        }
        
        if(filePath.getName().equals(".svn")){
          return;
        }
        for(String excludeFile:excludeFileList()){
          if(filePath.getPath().toLowerCase().contains(excludeFile.toLowerCase())){
            return;
          }
        }
        
        if(filePath.isDirectory()){
          File[] childFiles = filePath.listFiles();
          if(childFiles!=null){
            for(File childFile:childFiles){
              if(childFile.isFile()){
                handFile(childFile,fromCharSet, toCharSet);
              }else{
                replaceFile(childFile,fromCharSet, toCharSet);
              }
            }
          }
        }else{
          handFile(filePath,fromCharSet, toCharSet);
        }
      }
    }
    


  • 相关阅读:
    Sql的同一机器不同数据库联合查询示例
    poi 公式自動重新計算
    js 取得文件大小
    java 读写文件
    Postman安装及入门实践(以百度搜索为例)
    PostmanTests模块测试方法记录
    HTML颜色代码
    网盘搜索器 v1.0
    线程知识点一:如何传入多个参数
    asp.net 实现省市级联<简单方法2>前台实现
  • 原文地址:https://www.cnblogs.com/clnchanpin/p/6904068.html
Copyright © 2011-2022 走看看