views:

40

answers:

2

Hi, I'm investigating this for someone else but I hope this explanation is correct:

We have a lot of files and a lot of folders in TFS source control, but two of them are these (made up names):

$/Root/Shared/...

$/Root/Solutions/...

5 files from the folder $/Root/Shared/Client/Main are now checked in, and when looking at the changeset they all says 'edit' in the change field.

But, when looking at the paths, 3 of them are checked into $/Root/Solutions/Client/Main instead of $/Root/Shared/Client/Main. The last two are at the expected location.

And it gets worse; there is no, and is not supposed to be a $/Root/Shared/Client/Main folder. When browsing source control this location does not exist. And the files are not at their original locations either, they are just gone - except for when viewing them in the changeset.

What could have happened here?? I do have the code, since I can see them in the changeset, but I don't want to lose the history by just creating them again and copying in the code.

A: 

My guess is you have some screwy workspace mappings. Check for yourself in File -> Source Control -> Workspaces.

For best results (read: least amount of lost sleep on issues like this), create one single mapping at the highest level you need. If that's too broad, make this root mapping a "one level" mapping (using the * syntax; see docs) and then create additional recursive mappings with the same relative paths underneath it as needed.

Richard Berg
Thanks, I'll check it out. AFAIK this is the first time something like this has happened, though, if that info is worth something.
Just checked; there is only one mapping, at the root.
+1  A: 

Reading things more carefully, it sounds like you're describing files that have been renamed / moved over time.

TFS considers namespace information just as important as file contents. If you ask for an old version of $/Root, you don't just get the old version of those files, you get the old file & folder structure too, preserved exactly the way it was at that time. This design permeates the system, including the View Changeset dialog as you've seen.

The remaining question seems to be, where have my files gone? Quickest way to find out is to use a cmdlet from the Power Tools:

Get-TfsItemHistory -all .\rentest2\grand2\child2\parent\foo3.cs | 
    Select-TfsItem | 
    Format-Table -auto path, @{label="version"; expression={$_.versions[0].changesetid}}

Path                                                     version
----                                                     -------
$/Test-ConchangoV2/rentest2/grand2/child2/parent/foo3.cs   10725
$/Test-ConchangoV2/rentest/grand2/child2/parent/foo3.cs    10148
$/Test-ConchangoV2/rentest/grand2/parent/foo3.cs           10147
$/Test-ConchangoV2/rentest/grand2/child2/foo3.cs           10146
$/Test-ConchangoV2/rentest/grand2/child/foo2.cs            10145
$/Test-ConchangoV2/rentest/grand2/parent/child/foo2.cs     10144
$/Test-ConchangoV2/rentest/grand/parent/child/foo2.cs      10143
$/Test-ConchangoV2/rentest/grand/parent/child/foo.cs       10142

I have a little GUI tool that does this and more but haven't had time to get it to a publicly usable state, unfortunately.

Richard Berg
I didn't solve it myself, a guy from the IT department did, but what he said sounds very similar to what you are saying. Something about a shelveset being checked in after the structure on the server had changed.