tags:

views:

75

answers:

4

Why Why WHY doesn't TFS's get latest work consistently?

You would have thought that feature would have been tested thoroughly.

What I have to do is, get specific version, then check both overwrite writetable files + overwrite all files.

Is my local setup messed up or you do this also?

+3  A: 

TFS redefined what "Get Latest" does. In TFS terms, Get Latest means get the latest version of the files, but ignore the ones that the server thinks is already in your workspace. Which to me and just about everyone else on the planet is wrong.

See this link: http://blogs.microsoft.co.il/blogs/srlteam/archive/2009/04/13/how-get-latest-version-really-works.aspx

The only way to get it to do what you want is to Get Specific Version, then check both of the "Overwrite ..." boxes.

Chris Lively
@Chris -- that blog post is talking about something else entirely, i.e., that you don't get the latest version of a file when you check it out for edit. You simply mark that you are editing the version of the file that you currently have in your local version. Get Latest will update my local checked out copy with new files from other developers. Note that sometimes they forget to check in the project as well as the file so it doesn't appear in the solution, but the file is there nonetheless.
tvanfosson
@tvanfosson: I had posted the wrong link. An updated one is in there now.
Chris Lively
This isn't correct. TFS "get latest" works exactly as advertised, as long as TFS knows about changes to the files. Get Latest only "screws up" when people go out and modify filed outside of the IDE without checking them out first. Then, TFS thinks you have the latest source on disk, and doesn't get it.
Robaticus
@Robaticus: That's what I was trying to say, but the wording was wrong, guess that's what I get for typing too fast. I updated my wording.
Chris Lively
+2  A: 

"Get latest version" by default will only download the files that have changed on the server since the last time you ran "Get latest version". TFS keeps track of the files you download so it doesn't spend time downloading the same version of the files again. If you are modifying the files outside of Visual Studio, this can cause the consistency problems it sounds like you are seeing.

David
+3  A: 

TFS, like some other source control providers, such as Perforce, do this, as the system knows what the last version you successfully got was, so get latest turns into "get changes since x". If you play by its rules and actually check things out before editing them, you don't confuse matters, and "get latest" really does as it says.

As you've seen, you can force it to reassess everything, which has a much greater bandwidth usage, but behaves closer to how SourceSafe used to.

Rowland Shaw
A: 

Unfortunately, there has to be one or more bugs in TFS 2008, since this problem regularly crop up on developer machines and build servers where I work as well.

I can do Get Latest, I can see in the history list of the project that there have been commits after I last did a Get Latest, I have not touched the files on disk in any way, but after the "Get Latest" function has completed, when I check the TFS tab, some of the files still says that they're not the latest version.

Obviously TFS is able to determine that I have old files locally, since the list says so. Yet, Get Latest fails to do that, get the latest version. If I do what you did, use the Get Specific version, and check the two checkboxes at the bottom of the dialog, then the files are retrieved.

We changed our build servers to always use the Get Specific version type of function instead, so this part now works, but since our build server (TeamCity) also relies on checking if there have been changes to the files in order to kick off a build, sometimes it lapses into a "nothing changed, nothing to see here, move along" mode and does nothing until we forcibly run the build configuration.

Note that I have experienced this problem on a machine that is never touched, except for get latest + build, both manually, so there's nothing tampering with the files. It's just TFS getting confused.

One time this cropped up I verified that the files on disk was indeed binary identical to the version previously retrieved, so no manual tampering had been done with the files.

Also, I fail to see how TFS can "know" whether files have changed on disk or not without actually looking at the contents. If one part of TFS can see that the files are indeed not the latest version, then the Get Latest version should absolutely be able to get the latest version. This in reference to comments to other answers here.

Lasse V. Karlsen
TFS depends on a files version number to know whether you have the "latest" version or not. That number is maintained entirely in TFS and is only updated when someone does a check in. So, when you "Get Latest", TFS checks it's database to see what the last version sent to you was. If this number is equal to the current version, then it believes you have the latest; regardless of what is actually on your local file system. The idea was to limit down network traffic. Unfortunately, the only way this model works is if all edits occur within an application that has knowledge of TFS.
Chris Lively
Also, I agree there is at least one bug with 2005/08's version of this. I've seen the exact issues you've described on multiple machines; which is what lead me to use Get Specific version religiously.
Chris Lively
In some of the cases, edits have happened entirely within Visual Studio on one machine, the other machine, which sole purpose is to do get latest + build, no local changes are being done, ever. Yet it manages to screw this up. I'm not impressed with TFS Source Control to say the least. Hopefully 2010 will have fewer of these problems.
Lasse V. Karlsen