您可以在不需要工作区的情况下进行 TFS get 吗? [英] Can you do a TFS get without needing a workspace?

查看:21
本文介绍了您可以在不需要工作区的情况下进行 TFS get 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将我们的构建脚本从使用 SourceSafe 更改为 TFS,而不使用 MsBuild(目前).

I'm trying to change our build scripts from using SourceSafe to TFS without using MsBuild (yet).

一个小问题是工作区目录被脚本重命名和归档,这让 TFS 认为它不需要获取任何文件.即使使用 /force 标志,它也只是获取目录而不获取源文件.

One hiccup is that the workspace directory is renamed and archived by the scripts, which makes TFS think it doesn't need to get any files. Even with the /force flag it just gets the directories without getting the source files.

我正在使用

TF.exe get "Product/Main/Project1"  /force /recursive /noprompt

为了省去我在脚本中管理工作区或使用中间目录的麻烦,有没有人知道无需工作区即可获取目录和代码的命令?

To save me managing workspaces in the scripts or using intermediate directories, does anyone know of a command that can get directories and code without needing a workspace?

推荐答案

没有工作区就不可能运行 tf get.原因是服务器需要知道服务器路径和本地路径的映射关系.

It's not possible to run a tf get without a workspace. The reason is that the server needs to know the mapping between the server paths and the local paths.

如果您正在处理大量文件,那么以下操作不是一个好主意:

If you are working with a large number of files, it is not a good idea to:

  1. 创建 &每次删除一个新的工作区
  2. 或者,创建一个新的工作区(然后永远不要删除它)

这样做的原因是每次执行 Get 时,服务器都会跟踪哪些文件、哪些版本被下载到哪个工作区.如果您从不清理这些工作区,那么存储这些信息的表就会随着时间的推移而增长.

The reason for this is that every time you do a Get, the server keeps track of which files, at which versions were downloaded to which workspace. If you never clean up these workspaces, then the table that stores this information will grow over time.

此外,如果您正在创建 &一直删除工作区,服务器必须写入所有这些行,然后在完成后删除它们.这是不必要的.

Additionally, if you are creating & deleting a workspace all the time, the server has to write all these rows, then delete them when you are done. This is unnecessary.

您真的应该每次都尝试重复使用相同的工作区.如果您这样做,服务器将非常高效地只向您发送自您上次下载以来已更改的文件.即使您的构建从一个分支移动到另一个分支,您也可以使用 tf get/remap 如果分支共享公共文件,有时效率会更高.

You really should try and reuse the same workspace each time. If you do, the server is very efficient about only sending you files that have changed since you last downloaded them. Even if your build is moving from one branch to another, you can use tf get /remap which is sometimes more efficient if the branches share common files.

虽然它不能解决您的问题,但可以在没有工作区的情况下列出文件和下载文件.

Although it doesn't solve your problem, it is possible to list files and download files without a workspace.

要列出文件:

tf dir $/Product/Main/Project1 /R

下载文件:

tf view $/Product/Main/Project1/file.cs

对于创意批处理文件,您可以使用 FOR 命令将这两个文件串在一起.但是,我建议您首先尝试解决您的工作区问题,因为这是 TFS 旨在使用的方式.

With a creative batch file, you can string these two together with a FOR command. However I would recommend trying to solve your workspace problem first, since that is the way that TFS was intended to be used.

这篇关于您可以在不需要工作区的情况下进行 TFS get 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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