views:

70

answers:

2

When shelving a set of changes, I uncheck "Preserve pending changes locally". The changed files revert to their previous version, but the newly added files remain in my project directory.

To keep working on the application without these new changes, I then have to manually delete all the new files that I have added.

  1. Is this normal behavior or am I doing something wrong?

  2. If this is normal, is there a way of getting rid of newly added files when shelving them?

+1  A: 

I just tried this using VS-2008 with power tools installed on TFS 2008 and it delted the new file from my workspace.

Are you shelving your project at the same time so the file add is removed from the project as well?

Ryan
Currently the newly added files do get removed when I shelve them, whether or not I shelve the project file, and I am unable to reproduce my previous problem. It must be some weird combination of steps. But still, thanks!
Edo
+2  A: 

1) This is normal. Shelve /move is implemented as regular Shelve + Undo. While it's always safe to clean uncontrolled files from your local disk after they're stored on the server, the call to Undo() doesn't know this, so it leaves pending adds behind like it always does. There have been feature suggestions since v1.0 to track this behavior more granularly so that files can be cleaned up when appropriate, and/or to use a platform specific "safe delete" (read: move to Recycle Bin if you're on Windows). But AFAIK none has been implemented to date.

2) The latest TFS Power Tools added a feature 'tfpt unshelve /undo' that handles this more intelligently. It's also trivial with a Powershell pipeline: tfshelve <parameters> | tfundo | tfprop | del

Change to your project files shouldn't affect this behavior one way or another. Though if you do add the file to a project & fail to undo that edit, you'll see an orphan file reference in Solution Explorer.

Richard Berg