Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
480 views
in Technique[技术] by (71.8m points)

move - Moving files lose history in TFS 2013

I'm using VS2013 Update 4 with TFS 2013 Update 4. In Source Control Explorer, whenever I move a file from one folder to another I can see that the file's history is preserved in the new location. However, that history is gone when I check-in the pending changes. The same thing happens when I try to run "tf move" command. So, how can you move a file in TFS and still keep the file's history?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

When a file is renamed correctly, the History is not "Gone", it's associated to the "old name" instead. A rename that is done the right way (tracked as a rename and not as an delete+add) has a drilldown option to view the "older" history:

enter image description here

  • Changeset 81~82 contain the changes to the old name
  • Changeset 83 contains the delete + rename
  • Changeset 84 a new change that was checked in after the rename

When a rename is done outside of the Source Control Explorer (or from a very old version of the Source Control Explorer (e.g. VS 2008)) or outside the Solution Explorer, then the change will be detected as two individual actions, one delete and one add. You can use the "Pending Changes" window to promote these to a rename so that the history is preserved:

enter image description here

On the commandline this can only be accomplished using "tf rename" and "tf move". Using the standard "mv" and "ren" commands will fail to preserve the history.

Below is a further example of using all the different methods and clearly showing that history is preserved by looking at the history of the current file name:

enter image description here

As mentioned in the comments, history is stored in the Team Project that contains the items revision. When branching/moving across projects your history will be spread across these projects. Should you delete a Team project than all history that was accumulated in that project will be lost.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...