1
Vote

Executing 'cpc su' immediately after deleting and then re-creating a project deletes local files and corrupts local state

description

If you execute 'cpc su' after deleting and then re-creating a CodePlex project, CPC deletes all local files, including the root _tfs folder, which corrupts its local state and prevents executing any other CPC commands.

Steps to reproduce:
Create a new CodePlex project
Execute 'cpc co' for the project
Create a new file in the project's local directory
Execute 'cpc su' to mark the local file for addition
Execute 'cpc ci' to add the new file
Delete the CodePlex project
Re-create the CodePlex project
Execute 'cpc su'

Exepcted result:
An error message is displayed stating that the repository's history changed unexpectedly and that the command could not be executed.

Actual result:
The root _tfs folder and the local file are deleted.

comments

BradWilson wrote Dec 4, 2007 at 7:56 AM

Unfortunately, for the time being, this is working as designed. The specific steps involved include a destructive deletion of all the content, something that's otherwise not possible. When attempting to reconcile the "old" state with the "new" state, the TFS server says "the new state says there's nothing here",. and all unchanged files are thus removed. The fact that the delete was massive and destructive, rather than individual and with history, isn't something that cpc is aware of.

The best mitigation we could offer would be to process all the deletes by way of the Recycle Bin, although that comes with potential issues as well (such as the possibility of overflowing the Recycle Bin, or of the fact that the user can disable the Recycle Bin functionality entirely).

drewmiller wrote Dec 5, 2007 at 2:32 AM

I modified the expected result.

In this case, of a project being deleted and then re-created, I think we should prevent any further CPC activity for the local folder. Instead, we could just display a message along the lines of "The repository's history changed unexpectedly and the command cannot execute." Admittedly, I haven't investigated the technical feasibility of this approach.

This would force the user to re-checkout the project, but in this case I don't think that is a bad thing. Thoughts?