Jump to content

Deleting checkout file in VS2010


Soho

Recommended Posts

This may be by design, but as a user the following is a bit surprising behavior in the VS2010 plugin:

If you have a file checked out and choose to delete that file using the solution explorer, you get an error from plastic telling you that you cannot delete a checked out file, but the file is removed from the project anyway.

This requires the user to remember to go into the plastic items browser, uncheck the file and then delete it, which is often forgotten since the file is not visible in VS2010 anymore.

It would be nice if plastic simply unchecked the file and deleted it in the first place. It is hard to imagine a scenario where this is not the desired action.

Link to comment
Share on other sites

Hi Soho,

If the file is checked out, it means it contains changes.

Unchecking out the file will loose the changes.

We never accept an scenario where changes can be lost since then we would be the ones to blame.

The issue here is that instead of "being deleted" the file is just unbinded.

If I remember correctly there's a setting in VS to show the "files that are not binded to the project". This way it would be very easy to locate it back.

I see it is not comfortable but correct me if I'm wrong: isn't it a corner case? I mean, it is not very common, is it?

Link to comment
Share on other sites

If the file is checked out' date=' it means it contains changes.

Unchecking out the file will loose the changes.

[/quote']

Surely changes would be lost be undoing checkout, but so will deleting it. There seems to little point unchecking changes in a file you explicitly wants to delete. I believe that other SCMs will just delete the file when asked to.

If I remember correctly there's a setting in VS to show the "files that are not binded to the project". This way it would be very easy to locate it back.

Yes' date=' I can find the file again, but the point is that I don't want to find it. I want to delete it and forget about it. Not cluttering my project folders with old unused files. When you delete the file you get an error from Plastic telling you, that it cannot be deleted, but the file disappear from the project in the solution explorer. I think a lot of people, including myself will intuitively conclude that the file was deleted anyway and the error dialog was a mistake.

I see it is not comfortable but correct me if I'm wrong: isn't it a corner case? I mean, it is not very common, is it?

It depends on your working habits. I use TDD and refactor a lot. Creating small classes that I eventually will refactor away is daily practice. So a refactoring cycle can easily be tinkering with some class (checked out) and then decide to delete it.

I am not saying that what Plastic does is wrong, but I don't think it is intuitively that files you delete in VS are not deleted in Plastic. I know that you might want to protect the scenario where someone makes a lot of changes to a file and then accidentally delete it, but if deleting a checked out file should not be allowed, then the Plastic should block VS 2010 from deleting it until the checkout was undone or checked in.

A button for undoing and then deleting in the "cannot delete checked out" error dialog would of course be optimal for everybody.

Link to comment
Share on other sites

Another scenario:

I just made a common refactoring using Resharpers "Move to folder".

This resulted in the above error message, but the file was deleted on disk, but not from the plastic source control. Which left my workspace with missing files.

This requires me to remember to go into Plastic's item explorer and delete the missing file. If I forgot to do that, the file would suddenly appear the next time I would switch to that branch and that would be a surprise.

It is also a lot of work just to move a file, which greatly reduces the speed of using refactoring tools, something that breaks your concentration of what you were really trying to do.

Link to comment
Share on other sites

Hi Soho,

About issue 1 - delete checkout file. I'll ask if it is possible to "cancel" the op so that VStudio doesn't delete it... would it be fine?

About issue 2 - can you give me more details? A "move" should be a different operation than a "delete". We "hook" the VStudio "move operation" (you're using the VSPackage, not SCC, right?) and we do a "move" in Plastic, so please give me more details because I don't understand why the file gets deleted.

Thanks,

pablo

Link to comment
Share on other sites

About issue 1 - delete checkout file. I'll ask if it is possible to "cancel" the op so that VStudio doesn't delete it... would it be fine?

Yes' date=' absolutely. I would be better if I could cancel the operation and undo the checkout and then delete it, rather than the file just disappears from VS2010, but not from source control.

About issue 2 - can you give me more details? A "move" should be a different operation than a "delete". We "hook" the VStudio "move operation" (you're using the VSPackage, not SCC, right?) and we do a "move" in Plastic, so please give me more details because I don't understand why the file gets deleted.

I move the file using a refactoring method in Resharper (an excellent VS2010 plugin). Apparently Resharper moves the file by deleting the original and creating a new. I don't know if this could be because Resharper does not know that the Plastic VS2010 plugin supports the move operation and they have split the move in delete / add to support all source control systems.

Link to comment
Share on other sites

Hi again,

About 1- I'm asking right now developers to check it. If it is easily doable you'll have it next week. We'll consider changing the behavior on 4.0.

About 2- We're going to check ReShaper. One note:

- In 4.0 we do include a great "find changes" functionality which is able to track moves of files/directories that you've done outside SCM control (like if you just do a move from the CLI or Explorer)

- It will detect the move done by ReShaper doing a delete and a move... even if you modify the code after moving (change detection is based on similarity)

We'll also check what ReShaper is doing.

Link to comment
Share on other sites

That sounds great! thank you.

About the "find changes" thing in 4.0. I have been missing a lot a function to auto-undo all non-changed items. Often the IDE check out stuff that doesn't change (e.g. the VS GUI designed does this all the time).

In TFS power tools there is an tfpt.exe UU command that auto-undo all unchanged items, which is really useful when you want to get an overview of the changes you have made just before you commit a changeset.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...