开发者

TFS version control - File deleted, added - how do we tell TFS it was a move?

We are doing some major refactoring and in the course of that we are moving a lot of files. We use ReSharper which makes this 开发者_运维百科(relatively) painless as it updates all uses everywhere when we move files - even to a different project. So everything is great.

Except we just discovered today that ReSharper would tell TFS to delete the file in the old location and then insert as a new file in the new location. How can we tell TFS that this delete/insert was actually a move?


I faced a similar situation where I wanted to move files between projects and I wanted to have Resharper do as much work as possible. Here are the steps I ended up doing:

  1. Move the file in Resharper. This will make the appropriate change to the target project file.
  2. Close the solution or disable Resharper.
  3. Undo the delete/add in TFS.
  4. Move the file in TFS.
  5. Make sure that the moved file is no longer in the source project.
  6. Reload the solution or re-enable Resharper.
  7. Use Resharper to make any namespace changes.

Obviously one can do it with more than one file at a time. It's a pain, but TFS ends up with the right change, and Resharper takes care of changing references.


Short answer: You don't.

Long Answer: You don't unless you want to run the possibility of completely hosing your source control.

From the perspective of TFS, the file in the new location is a completely different file. It even has a different ID in the database server.

Now you could certainly go spelunking in your TFS database and try to manually update the file id associations. But this has an extremely high probability of completely screwing yourself... unless you were one of the main developers of TFS that was intimately familiar with the backend of the product. In which case you wouldn't be asking this question. ;)

Slightly off-topic item: You should contact jetbrains and tell them to fix this.


"tf rename" will tell TFS the file has moved.

http://msdn.microsoft.com/en-us/library/a79bz90w.aspx

If you are in VS and move a file from one folder to another, you can see TFS pends a rename. You can also move a file from one folder to another, and then rename the file. TFS pends a rename.

Apparently when resharper is moving files around it is not using move and rename apis in the VS project system, or I would expect this to "just work".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜