简体   繁体   English

如何在 TFS 上撤消“获取最新版本”

[英]How to undo a “Get Latest Version” on TFS

I'm using TFS with VS2008 and VS2010 and in the TFS collection I have several projects.我在 VS2008 和 VS2010 中使用 TFS,在 TFS 集合中我有几个项目。

I've mapped the TFS root to a local drive to preserve the TFS folder structure and I've done a Get Latests of several subfolders.我已经将 TFS 根映射到本地驱动器以保留 TFS 文件夹结构,并且我已经完成了几个子文件夹的获取最新信息。

I downloaded also an unwanted folder so I deleted the local folder contents but now in the TFS I see that folder in black and "Latest" Yes.我还下载了一个不需要的文件夹,所以我删除了本地文件夹的内容,但现在在 TFS 中,我看到该文件夹​​为黑色,“最新”是。 How can I tell TFS that I've locally deleted a folder that I previously downloaded?如何告诉 TFS 我在本地删除了之前下载的文件夹?

I think the problem is that you do not agree with TFS on what "latest" mean.我认为问题在于您不同意 TFS 关于“最新”的含义。 "Latest" in TFS mean that nothing has changed on the server since you did get latest. TFS 中的“最新”意味着自从您获得最新信息以来,服务器上没有任何变化。 It do not mean that what is on the hard drive is equal to the latest version on the server.这并不意味着硬盘驱动器上的内容等于服务器上的最新版本。 So TFS shows what it is supposed to, see this question for more: Why doesn't TFS get latest get the latest?所以 TFS 显示了它应该做什么,更多信息请参见这个问题: Why not TFS get latest get the latest?

The intended solution for folders on the server that you do not want to have on your local hard drive is "Cloak", as MBulava mentioned.正如 MBulava 所提到的,对于您不想在本地硬盘驱动器上拥有的服务器上的文件夹的预期解决方案是“Cloak”。 (Right click folder -> Cloak). (右键单击文件夹 - > Cloak)。 If you do not wish to have a folder on your hard drive I recommend this solution as it will never be downloaded until you uncloak it, and will show as greyed out and "not downloaded".如果您不希望在您的硬盘驱动器上有一个文件夹,我推荐这个解决方案,因为它永远不会在您取消隐藏之前下载,并且会显示为灰色和“未下载”。

If you want to look at the differences between the contents on the hard drive and the server version you can use the "compare folders" feature.如果您想查看硬盘上的内容和服务器版本之间的差异,您可以使用“比较文件夹”功能。 It will show that the folder is deleted on the hard drive.它将显示该文件夹已在硬盘驱动器上删除。

If you want to get the folder mapped and grey (as the other folders you did not download) you can cloak it, and then uncloak it but answer "No" to downloading it now.如果您想将文件夹映射为灰色(与您没有下载的其他文件夹一样),您可以隐藏它,然后取消隐藏它,但现在回答“否”以下载它。 This is equivalent to not downloading the folder in the first place.这相当于一开始就没有下载文件夹。

Martin Woodward has a cool TFS Top Tip #11 - Removing source control files from your local file system blog post that answers this problem without resorting to cloaking. Martin Woodward有一个很酷的TFS 顶级技巧 #11 - 从您的本地文件系统博客文章中删除源控制文件,它可以在不诉诸伪装的情况下解决这个问题。

You need to Get Specific Version , change the Version Type to Changeset and specify 1 for Changeset number.您需要获取特定版本,将版本类型更改为变更集并为变更集编号指定1 His blog post goes into detail about why this works.他的博客文章详细介绍了为什么会这样。 I've verified this behavior in Team Explorer for Visual Studio 2013, 2015 and 2017.我已经在 Visual Studio 2013、2015 和 2017 的团队资源管理器中验证了这种行为。

Update:更新:

If you have got a bunch of folders to process you can use the command line as follows replacing folderName with the relative folder as the Client itemspec or the equivalent Server itempec :如果您有一堆文件夹要处理,您可以使用如下命令行将folderName替换为相对文件夹作为Client itemspec 或等效的 Server itempec

tf.exe get folderName /v:1 /recursive

Mbulava's suggestion to use 'cloak' will leave the files and/or folders on the TFS server but will remove the files / folder from your local version and from the 'Get Latest Version' request. Mbulava 建议使用 'cloak' 会将文件和/或文件夹留在 TFS 服务器上,但将从您的本地版本和“获取最新版本”请求中删除文件/文件夹。

If you have deleted files from your local directory and you then want those changes to appear on the server you need to go to the TFS director, select the files you want to delete, right click and delete the folders.如果您从本地目录中删除了文件,然后希望这些更改出现在您需要转到 TFS 目录的服务器上,请选择要删除的文件,右键单击并删除文件夹。 Then you need to 'Check In' the pending deletion changes to the TFS server.然后,您需要将待处理的删除更改“签入”到 TFS 服务器。 TFS server will then delete the files / folders.然后 TFS 服务器将删除文件/文件夹。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM