Why doesn’t Team Foundation get the latest version of a file on checkout?


I’ve seen this question come up a few times.  Doug Neumann, our PM, wrote a nice explanation in the Team Foundation forum (http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=70231).

It turns out that this is by design, so let me explain the reasoning behind it.  When you perform a get operation to populate your workspace with a set of files, you are setting yourself up with a consistent snapshot from source control.  Typically, the configuration of source on your system represents a point in time snapshot of files from the repository that are known to work together, and therefore is buildable and testable.

As a developer working in a workspace, you are isolated from the changes being made by other developers.  You control when you want to accept changes from other developers by performing a get operation as appropriate.  Ideally when you do this, you’ll update the entire configuration of source, and not just one or two files.  Why?  Because changes in one file typically depend on corresponding changes to other files, and you need to ensure that you’ve still got a consistent snapshot of source that is buildable and testable.

This is why the checkout operation doesn’t perform a get latest on the files being checked out.  Updating that one file being checked out would violate the consistent snapshot philosophy and could result in a configuration of source that isn’t buildable and testable.  As an alternative, Team Foundation forces users to perform the get latest operation at some point before they checkin their changes.  That’s why if you attempt to checkin your changes, and you don’t have the latest copy, you’ll be prompted with the resolve conflicts dialog.

Comments (33)

  1. Keith Hill says:

    This is another reason why TF should probably break from tradition and refer to this operation as "edit" or "Make editable". The term checkout carries baggage with it that is going to confuse people until they form the correct mental model for TF. Same goes for checkin, which IMO should be called "commit". Why? Because you wouldn’t think that "checkin" applies to directories you’ve added, files you have renamed or branches you have created. The term "commit" OTOH fits better and helps convey a more accurate mental model. It’s not too late to give up obsolete terminology and pick terms that accurately reflect TF reality. :-)

  2. buckh says:

    From the command line, you actually have that choice. Edit and checkout are command aliases, and so are submit and checkin. In both the GUI and the command line, the status will show "edit" for a checked out file. The GUI uses only the traditional VS/VSS terminology for the actions, though.

  3. Microsoft Solutions Framework Fun

    Visual Studio 2005 Team System Note on IT

    MSF for CMMI Process…

  4. Keith Hill says:

    I knew about the edit command line alias which I do like. I didn’t know about the "submit" alias though. Is there a compelling reason not to just call it "commit" instead of "submit"? Of course, either one is still better than checkin IMO. :-)

  5. buckh says:

    There’s no compelling reason. Lots of people have had various opinions about it, though.

  6. Keith Hill says:

    Yeah it just seems that the term "commit" has a well known meaning that is more inline with what happens when you checkin files in TF. "Submit" also has meaning but is more geared toward "submitting a job" which I think is not quite accurate for TF. I kind of wish the VS UI would switch between between edit/checkout and commit/checkin depending on how you set up the exclusive lock mode. If you choose to work more like CVS/Subversion then edit/commit would appear on the menus/toolbars. If you choose exclusive (checkout) locks then stick with checkout/checkin. Just a thought. Sorry to be so nit-picky. The whole of TF is awesome from my experience so far. I would just like to see you get it as close to perfect as possible. I want to have the best shot of justifying a migration off our "other" SCM system. :-)

  7. Launch Tour 2005 Knowledge Center

    The launch site for VS2005 and SQL Server 2005

    Thom Robbins -…

  8. Buck Hodges answers (via Doug Neumann) the question: Why doesn’t Team Foundation Server get the latest…

  9. Ron Buckton says:

    Resolve/Merge is often more complex than a get operation. Wouldn’t it make sense to either prompt the user if they want to get latest, or at least provide some visual indication that the current file you have just "made editable" differs from the latest version in source control? On a .NET 2.0/TFS project i’m working on currently we are constantly running into issues due to the fact that the "get latest" operation is not performed and no notification that the file has changed is made available.

    I have no problem with the choice to use the current file over a get latest as it does make sense from a consistency perspective however I think some type of "bubble tip", status bar notification, or output window message would serve to make this easier to see and track.

  10. buckh says:

    Ron, I agree that notification that you don’t have the latest when you pend an edit is helpful, and we actually produce that info. I don’t think it was communicated in VS in beta 2 (you’d get the messages using h.exe, but VS wouldn’t necessarily process them). In the July CTP and the upcoming beta 3, you’ll get those messages in the Output window in VS.

  11. Rob says:

    "if you attempt to checkin your changes, and you don’t have the latest copy" – how is this determination made exactly?

  12. So this morning I starting editing a file for a project using VS 2005 with Visual Studio Team System. …

  13. Steven Smith says:

    Barry Gervin recently wrote some nice tips for working with source control and Team System on a mailing…

  14. If the battleground for VSS vs. TFS will be fought anywhere it will be on this issue.  As with any…

  15. To summarize the goals laid out in my reintroduction , I want a chance to start my TFVC "story" from

  16. As most SourceSafe users have probably discovered by now, TFS does not get the latest version of a file

  17. cnblogs.com says:

    使用TFS有一段时间了,有很多功能,例如源代码管理相关的,很以前的使用VSS和ClearCase等都不太一样。经过摸索,积累的一些经验,和大家分享一下吧! 1、TFS不仅仅提供了源代码管理的功能,还提供了任务管理、分析服务等许多功能,但这些功能必须全部安装,不能够定制安装,例如只安装其中的源代码管理工具:(

  18. qy1141 says:

    使用TFS有一段时间了,有很多功能,例如源代码管理相关的,很以前的使用VSS和ClearCase等都不太一样。经过摸索,积累的一些经验,和大家分享一下吧!

    1、TFS不仅仅提供了源代码管理的功能,还…

  19. SRLTeam says:

    Hi everybody, And again about the famous issue of the TFS version control – Get latest version on check-out.

  20. My VSTS Blog says:

    One of the issues I have heard most often when I am introducing TFS Version Control to a development

  21. The TFS team over at Sela , spearheaded by Tal Gur Arie, had developed a little addin that solves the

  22. Dennis' Blog says:

    As most Team Foundation Server (TFS) users will know by now, upon checkout of a file from source control

  23. LongSky says:

    TFS(TeamFoundationServer)使用经验

  24. Mayur N. says:

    Though this is a beaten-to-death topic, I feel the urge to vent some bottled-up frustration! I do see the merits of the "consistent code snapshot" philosophy but, having gone through the pain of resolving a whole flock of avoidable conflicts in my team due to "stale edits" on first moving from VSS to TFS, I consider the lack of notification and the total omission of the "get latest on check out" option a near-criminal miss by the TFS Dev team. Why does it have to be "my way or the highway"?! After all, it was Microsoft’s home-grown VSS that inculcated these "bad" habits to begin with! Now Microsoft may well have the luxury of putting all their new developers through a comprehensive TFS training program before their projects begin but the least I would expect in a VSS successor is a dialog box the first time around with the option to control default behavior! Oh well, at least 2008 brings some relief…

  25. buckh says:

    Mayur, you’ll be happy to know that we’ve added an option in TFS 2008 to get the latest on checkout.

    Buck

  26. I’ve seen quite a bit of angst from new TFS users over the "Get Latest Version" behavior in

  27. As TFS users probably know TFS 2005 (unlike SourceSafe and other Source Control tools) didn’t perform