使用 TFS 命令行 tf.exe 如何将存储库复制到我选择的文件夹位置? [英] Using TFS command line tf.exe how can I copy a repo to a folder location of my choice?

查看:44
本文介绍了使用 TFS 命令行 tf.exe 如何将存储库复制到我选择的文件夹位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始在我的 MSVS 2015 C++ 项目中使用 TFVC.我习惯于使用 git/svn 之类的命令行存储库,在那里我可以简单地进行结帐/克隆等操作……并将文件复制到我喜欢的任何文件夹中.

因此,我已通过 MSVS2015 GUI 将我的工作区检出到映射位置 (c:\myworkspace).但是现在我想运行我的自动测试脚本,它将最新的文件从 repo 复制到当前目录(例如 c:\autorun).自动测试脚本构建和测试并生成结果等......但我希望它只是覆盖我在我的工作区中拥有的内容,以防其他人添加了更改.>

我希望它转到我选择的其他文件夹.

在 Git 中,我只需导航到文件夹 (cd c:\autorun),然后执行 git clone .但我看不到 TFVC 的工作区如何实现这一点.

到目前为止,我已经开始修改与 git 一起使用的脚本以获得此:

' 清除任何现有文件:rmdir/S/Q <项目名称>' 结帐项目tf checkout <项目名称>/递归' 做其他事情(构建测试等...)

但这仅适用于我的 c:\workspace - 我不想删除/覆盖我的本地更改.

解决方案

您可以使用

创建一个新的(临时)工作区

cd tempmd 新建文件夹tf vc 工作区/new ...tf vc workfold/map $/Project/Folder c:\temp\newfoldercd 新文件夹tf vc 得到./递归tf工作区/删除

或者您可以使用 Neno Loje 编写的小实用程序,TfsExport.

从 OP 更新

假设我从要将项目解压缩到的文件夹中开始.我使用了以下内容:

tf dir 显示我拥有的存储库:

D:\sandbox\tfs-test >目录$/:$tfsRepo1$tfsRepo2$tfsRepo3

我只想要前两个仓库:

tf vc 工作区/new/noprompt cittf vc 获取 tfsRepo1/递归tf vc 获取 tfsRepo2/递归

然后整理:

tf 工作区/delete cit/nopromptrmdir/S/Q tfsRepo1rmdir/S/Q tfsRepo2

注意在不同地方使用/noprompt,这样就不需要用户交互.

I have stared using TFVC for my MSVS 2015 C++ project. I am used to command line repos like git/svn, where I can simply do a checkout/clone, etc... and copy the files to any folder I like.

So, I have checked out my workspace to a mapped location (c:\myworkspace) via the MSVS2015 GUI. But now I want to to run my auto test script, which will copy the latest files from the repo to the current directory (e.g. c:\autorun). The auto test script builds and tests and generates results etc... But I don't want it to just over-write what I have in my workspace in case someone else has added a change.

I want it to go to a different folder of my choice.

In Git I would just navigate to the folder (cd c:\autorun) and then do git clone <repo-path>. But I can't see how this is possible with TFVC's workspaces.

So far I have started to modify my script that worked with git to get this:

' Clean any existing files:
rmdir /S /Q <projname>

' Checkout project
tf checkout <projname> /recursive

' Do other stuff (build test etc...)

But this only works in my c:\workspace - and I don't want to delete/overwrite my local changes.

解决方案

You can create a new (temporary) workspace using

cd temp
md newfolder
tf vc workspace /new ...
tf vc workfold /map $/Project/Folder c:\temp\newfolder
cd newfolder
tf vc get . /recursive
tf workspace /delete

Or you can use the little utility written by Neno Loje, TfsExport.

Update From OP

Assuming that I start in the folder that I want to extract my projects into. I used the following:

tf dir shows the repos I have:

D:\sandbox\tfs-test > tf dir
$/:
$tfsRepo1 
$tfsRepo2
$tfsRepo3 

I just want the first two repos:

tf vc workspace /new /noprompt cit
tf vc get tfsRepo1 /recursive
tf vc get tfsRepo2 /recursive

Then to tidy up:

tf workspace /delete cit /noprompt
rmdir /S /Q tfsRepo1 
rmdir /S /Q tfsRepo2

Note the use of /noprompt in various places so that there is no user interaction required.

这篇关于使用 TFS 命令行 tf.exe 如何将存储库复制到我选择的文件夹位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆