命令行"获得最新的"从TFS没有映射工作区和这样的 [英] Command line "get latest" from TFS without mapping workspaces and such

查看:635
本文介绍了命令行"获得最新的"从TFS没有映射工作区和这样的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为这样的:

tf.exe get $/project /recursive

...需要这个奇怪的工作区映射,称为TFS服务器等。

...needs this weird workspace mapping, known TFS server and such.

有什么办法,我可以做到这一点最简单的事情:去连接的这个的TFS服务器中使用到的这个的一组凭据,获得最新的源代码code代表的这个的项目,并把它的这里的?所有的命令行。

Is there any way I could do this simplest thing: go connect to this TFS server using this set of credentials, get latest source code for this project and put it here? All from the command line.

推荐答案

首先,你想不再源控制下(如SVN出口),或者是控制文件的副本,你仍然希望工作与文件和TFS?

Firstly, are you wanting a copy of the controlled files that are no longer under source-control (such as a SVN export) or are you still hoping to work with the files and TFS?

如果您只是想最新的文件,并没有捆绑到TFS,你将不得不自己做一些作品的复制品。撇开凭据( [/登陆:用户名,[密码]] 参数许多命令行方式)

If you simply want a copy of the latest files and no 'binding' to TFS, you're going to have to do a little work yourself. Leaving aside credentials ([/login:username,[password]] parameter to many command line methods).


  1. 使用 TF 命令来获取文件的列表: TF目录$ / YourSolution/递归> files.txt

  2. 过程 files.txt 有一些聪明的批处理文件(或使用脚本语言):

  3. 阅读开始 $ / 行,这是目录,在您的目的地创建目录(删除前三个字符和最后一​​个字符,一个冒号)。

  4. 读取下一行(到空白或文件结束),每一种重新presents在步骤3中发现的目录中的文件假设你有一个变量文件%文件%和目录 DIR%%,然后发出以下命令(在该目录中的每个文件):

  1. Use the TF command to get a list of the files: tf dir "$/YourSolution" /Recursive > files.txt
  2. Process files.txt with some clever batch file (or use a scripting language):
  3. Read lines starting with $/ and this is the directory, create the directory in your destination (remove first three characters and the last character, a colon).
  4. Read the next lines (until blank or end of file), each of these represents a file in the directory discovered in step 3. Assuming you have the file in a variable %file% and directory %dir%, then issue the following command (for each file in that directory):

TF视图$ /%DIR%/%FILE%/输出:您-目标路径/%DIR%/%FILE%

如果你很高兴与当前目录作为目标:

or if you're happy with the current directory as the target:

TF视图$ /%DIR%/%FILE%/输出:DIR%%/%FILE%

请注意,您所需要的 DIR%%/%FILE%在输出部分或全部文件都将在同一个目录倾倒。

Note, you need the %DIR%/%FILE% in the output part or all files will be dumped in to the same directory.

请注意:这很可能是一个非常高的带宽和缓慢的操作

NOTE: this is likely to a be VERY high bandwidth and slow operation!


  1. 创建一个临时工作区: TF工作区/新/集:其中,URL_TO_SERVER> /权限:私人(注意,这会提示,也无提示选项,但确定的名称为工作空间留给读者作为练习)

  2. 请为文件的目录,例如 LOCALDIR

  3. 为您的文件夹创建一个映射: TF workfold /图$ / SERVER_DIRLOCALDIR

  4. 走进 LOCALDIR

  5. 获取文件 TF得到。 /递归

  1. Create a temporary workspace: tf workspace /new /collection:<URL_TO_SERVER> /permission:Private (note, this will prompt, there is a no-prompt option but determining a name for the workspace is left as an exercise)
  2. Make a directory for files, e.g. LOCALDIR
  3. Create a mapping for your folders: tf workfold /map "$/SERVER_DIR" "LOCALDIR"
  4. Go into LOCALDIR
  5. Get the files tf get . /Recursive

在这一点上,你现在应该有所有的文件,如果你想你也有与TFS的绑定,所以你可以提交更改。另外,您现在可以在内容复制到其他地方,打破映射/工作区。使用 TF workfold /取消映射的正确的命令行变种TF工作区/删除将取消映射你的workfolder和删除工作区

At this point you should now have all of the files and if you wanted you also have a binding with TFS so you could commit changes. Alternatively, you can now copy the content elsewhere and break the mapping/workspace. Using the correct command line variants of tf workfold /unmap and tf workspace /delete will unmap your workfolder and delete the workspace.

这篇关于命令行&QUOT;获得最新的&QUOT;从TFS没有映射工作区和这样的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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