Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TFS 2010: history lost after moving a folder

Tags:

label

tfs

history

In order to clean up my project structure, I moved a folder into another (new) folder through the TFS Power Tools Shell-Extension (Rename/Move).

After checking the history at the new place, the move is the only entry. (I tried one folder up, down, even on single files in the moved folder.. same result.)

I had also put on some labels on versions of the folder before the move, since there were some important states of the code I wanted to get back to.

So.. what went wrong, and how can I either get the history or at least find out the label names again and check out those versions?

like image 382
Andreas Reiff Avatar asked Dec 24 '12 12:12

Andreas Reiff


3 Answers

Turns out it is pretty easy.

In Visual Studio 2010, go to Tools->Options. There you can find the option to show "deleted" items (roughly in the middle of the dialog box). The old folder got deleted during the move - it will be displayed again after activating that option. (They will be kind of grayed with a red cross.)

Labels seem to have disappeared, though, so I had to go by version.

enter image description here

In the Source Explorer you have the normal operations again - like View History or Get.

like image 52
Andreas Reiff Avatar answered Nov 15 '22 17:11

Andreas Reiff


DISCLAIMER: For reference of everyone that gets here, this answer is not fixing @Andreas problem, just giving some context on why this happens and offering a couple of workarounds.

Seems that losing history when moving folders in TFS 2010 is not a bug, is a "feature". (still happening in TFS2012. From this MSDN link you can read official Microsoft answer:

Thanks for the feedback here. The previous comment about this being by design is correct, and there is an option on the command line. In the UI, history of folders is recursive - always. This is because most of the time, users care about the history of the contents of the folder. Files on the other hand dont have the concept of recursive history - you always see the history for the file itself. Now, from the command line, there is an option to show recursive history (/r) and if you run tf history on a folder without the recursive option, you'll see the changes to the folder itself. This would include changes such as a rename for the folder itself.

  • Workaround to get history once lost: As you can see there, you have a workaround using tf history.
  • Workaround to avoid losing history: If you want to avoid losing history in folders instead of using move feature, you can use TFS Integration tool to migrate code from one folder to other preserving history, migrating from $/TFSCode/FolderA to $/TFSCode/FolderB. It is a little bit overkill but if the history is pretty important for you is much better than looking for it in deleted folders
like image 20
Oscar Foley Avatar answered Nov 15 '22 16:11

Oscar Foley


It is true that the folder history is lost, but the individual file history is actually not lost. It is hidden under the little "expand me" arrow at the far left on a file history line. Expand it on the oldest history entry for a file, or anywhere you see it, and you will see history of that individual file also from an old location that no longer exists.

like image 14
user2570643 Avatar answered Nov 15 '22 18:11

user2570643