简体   繁体   English

在TFS中取消“获取最新版本”是否有效?

[英]Does canceling “get latest version” work in TFS?

I have chosen to get latest version from a TFS connected solution, and pressed cancel, is this operation transactional, I mean is canceling get latest version command cancels the whole operation or get some of the code and cancel the remaining files? 我选择从TFS连接的解决方案中获取最新版本,然后按“取消”,此操作是否具有事务性,我的意思是取消“获取最新版本”命令会取消整个操作或获取一些代码并取消其余文件?

My Machine: 我的机器:

TFS 2010 TFS 2010

VS 2010 SP1 VS 2010 SP1

TL;DR: Yes, it's possible to get into a state where some of the files in your working folder are at the requested changeset and some of the files are at their previous changeset. TL; DR:是的,有可能进入一种状态,其中工作文件夹中的某些文件位于请求的变更集,而某些文件位于其先前的变更集。 You may wish to do a get specific of the previous version you were at in order to "roll back" to that version. 为了“回滚”到该版本,您可能希望详细了解您所使用的先前版本。

To see what's happening, we can break this down into the actual steps that are being performed when you do a get: 要查看发生了什么,我们可以将其分解为获取时执行的实际步骤:

First, the client asks the server to get a particular version. 首先,客户端要求服务器获取特定版本。 The server will compute what files are needed to be transferred to bring you from the current changeset you're at to the changeset you requested. 服务器将计算需要传输哪些文件,以将您从当前的变更集带到您请求的变更集。 It will return these to the client as a series of "get operations". 它将作为一系列“获取操作”返回给客户端。

At this point, the client should spawn multiple threads to service the get operations. 此时,客户端应产生多个线程以服务于get操作。 Most of these threads will be threads that download the data and place it on disk. 这些线程中的大多数将是下载数据并将其放置在磁盘上的线程。 There will be an additional thread devoted to sending "local version updates" to the server. 将有一个附加线程专门用于向服务器发送“本地版本更新”。

The download threads take the get operation off the list returned by the server and download it to disk to a temporary location. 下载线程使get操作脱离服务器返回的列表,并将其下载到磁盘上的临时位置。 Once the download has finished, they will move it into its permanent location and notify the thread that sends local version updates that the file has been fully downloaded. 下载完成后,他们会将其移至其永久位置,并通知发送本地版本更新的线程文件已完全下载。

The local version update thread will batch local version updates coming from the downloader threads until some fixed number is reached, since a local version update message is very small and sending them one-at-a-time would incur unnecessary network overhead. 本地版本更新线程将批处理来自下载器线程的本地版本更新,直到达到某个固定数目为止,因为本地版本更新消息非常小,并且一次发送一次将导致不必要的网络开销。 Once the local version update thread has accumulated enough updates, they will be sent to the server. 一旦本地版本更新线程积累了足够的更新,它们将被发送到服务器。 This is the point at which the server knows the client has the versions of the files they requested. 这是服务器知道客户端具有他们请求的文件版本的时候。

The download threads will continue to service get operations until there are no more to process, and the local version update thread will continue until all download threads have finished downloading and all local version updates have been sent to the server. 下载线程将继续为获取操作提供服务,直到没有更多要处理的内容为止,本地版本更新线程将继续直到所有下载线程完成下载并且所有本地版本更新已发送到服务器为止。 Once these occur, the get has finished. 一旦发生这些,获取就完成了。

If a client supports cancellation, its logic should be as follows: if the user requests cancellation (eg, by pressing the "cancel" button in a UI-based client) then all download worker threads should be notified to cancel. 如果客户端支持取消,则其逻辑应如下:如果用户请求取消(例如,通过在基于UI的客户端中按下“取消”按钮),则应通知所有下载工作线程取消。 If they are in the middle of downloading a file, they should stop immediately (just discard the HTTP response they're reading.) However, once they have moved the file from its temporary location to its permanent location, they must notify the local version update thread before they exit. 如果他们正在下载文件,则应立即停止(只是丢弃正在读取的HTTP响应。)但是,一旦将文件从其临时位置移动到其永久位置,则必须通知本地版本在退出之前更新线程。 The local version update thread must wait for all download threads to finish, then flush any outstanding local version updates before it may exit. 本地版本更新线程必须等待所有下载线程完成,然后刷新所有未完成的本地版本更新,然后才能退出。

Thus, if you were to cancel in the middle of a get, you may have some of the files on-disk that you were trying to download, but the client and server should have a consistent view of the versions of each file. 因此,如果要在获取过程中取消,则可能在磁盘上有一些您要下载的文件,但是客户端和服务器应该对每个文件的版本具有一致的看法。

If you were to kill the client such that it was not able to cleanly stop the worker threads (by simply turning off power to your computer, for example) then you may be able to get into a state where the items had been committed to disk but the client had not yet flushed the local version updates to the server. 如果要杀死客户端,使其无法彻底停止工作线程(例如,仅通过关闭计算机电源),则可能会进入将项目提交到磁盘的状态但是客户端尚未将本地版本更新刷新到服务器。 In this case, you may have a version on-disk while the server believed you to have a different version. 在这种情况下,您可能在磁盘上拥有一个版本,而服务器认为您拥有另一个版本。 In the unlikely event that this would happen, you would need to use the "force" option when getting this file to reconcile this issue. 万一发生这种情况,在获取此文件以解决此问题时,您需要使用“强制”选项。

It is not transactional. 它不是事务性的。 Some files may already be downloaded. 有些文件可能已经下载。 In this case you should get a specific version after canceling your request. 在这种情况下,您应该在取消请求后获得特定版本。

In my experience pressing "Cancel" creates difference between versions you have on your disk and versions TFS thinks you have on your disk. 以我的经验,按“取消”会在磁盘上的版本与TFS认为磁盘上的版本之间产生差异。 So if you try to update again, nothing will be downloaded, because server thinks you already have the latest version. 因此,如果您尝试再次更新,则不会下载任何内容,因为服务器认为您已经拥有最新版本。

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

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