zoukankan      html  css  js  c++  java
  • TFS 自动同步Server 端文件的批处理命令

     

    目前在我们组的工作中很多时候需要将TFSServer端的代码自动无人值守的同步到本地中来, 找到了一些解决方案的资料http://bbs.scmroad.com/archiver/?tid-21003.html

    经过试验,我们总结成以下步骤,希望对大家有所借鉴。

     

    Steps

    1.       点选VS Source Explorer 上面的TFS目录列表。

    2.       新建一个TFS workspace

    3.       点击Source Control Folder

    4.       Source folder中选择你要用从Server端同步的目录。

    5.       Local Folder中选择本地同步的文件夹。

     

     

    6.打开本地注册表,进入下图中标注的Key node path. 新建一个键值项,键值项的value指向你的TFS Server地址。

          如果新建的key(E.g. TFSServer)的父节点的nodeE.g. Servers)不存在, 则需要先创建一个。

     

     

     

     

    7.新建一个批处理文件,写入以下代码。将批处理加到Windows的计划任务后即可自动执行同步TFS

     

    @ECHO OFF

    REM 本地映射TFSproject的路径

    SET GetPath="I:\TFSAutoDownload\TFSRFT_Gen850"

    REM TFSproject的路径

    SET TFSPath="$/Geneva_QA/Branches/Release/Geneva_8.5.Up4/RFTTrunk"

    REM 创建的用于同步的TFS Workspace的名字

    SET WorkspaceName="TFSAuto850"

    REM 在注册表中注册的TFS的键值

    SET TFSServer="TFSServer"

    REM 本地安装的TFSExplore路径,一般默认的是指向C

    SET VSLocPath="E:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE

    ECHO Trying TFS get...

    ECHO.

    REM IF NOT EXIST Create GetPath

    IF NOT EXIST %Getpath% MD %Getpath%        

    REM if exists remove WORKSPACE and create NEW WORKSPACE

    REM 开始执行同步的时候在参数列表中要给出连接帐号和密码

    %VSLocPath%\tf.exe" workspace /delete %WorkspaceName% /noprompt /s:%TFSServer% /login:dwei,!ufida1

    %VSLocPath%\tf.exe" workspace /new /s:%TFSServer% %WorkspaceName% /noprompt /login:dwei,!ufida1

    REM unmap default WORKING FOLDER for newly created WORKSPACE

    %VSLocPath%\tf.exe" workfold /s:%TFSServer% /workspace:%WorkspaceName% /unmap $/ /login:dwei,!ufida1

    REM map WORKING FOLDER for newly created WORKSPACE

    %VSLocPath%\tf.exe" workfold /server:%TFSServer% /workspace:%WorkspaceName% /map %TFSPath% %Getpath% /login:dwei,!ufida1

    REM get the recent path through DOS command

    pushd %Getpath%

    REM get latest source from TFS

    %VSLocPath%\tf.exe" get %TFSPath% /recursive /noprompt /login:dwei,!ufida1

    ECHO.

    REM move back to actual path through DOS command

    popd

    ECHO TFS get completed...

     

     

     

     

    - Make people around you successful is the biggest contribution to ourselves. -

  • 相关阅读:
    @ControllerAdvice 全局异常处理
    SpringBoot 单文件和多文件上传
    Springboot application 本地HTTPS配置
    不使用spring-boot-starter-parent进行依赖的版本管理
    构造函数和函数式接口
    函数式接口和Lambda表达式
    使用FunctionalInterface提供工厂方法
    Future 和 CompletableFuture 异步任务 in Java
    单例
    使用私有仓库(Docker Registry 2.0)管理镜像
  • 原文地址:https://www.cnblogs.com/zencorn/p/2660320.html
Copyright © 2011-2022 走看看