I have a local folder within the tfs workspace and use the TFS-API.
Every night i do delete this folder and and after that script a database as .sql files. If now something was added or edited, the changes will be found and get into the pending changes to checkin.
The question is how i can detect with the TFS-API that a file is missing (intentionally, because no longer in database and becaus of that no longer scripted). The first step is obvious, delete all files and script all in the empty folder.
I use workspace.PendEdit at the beginning which makes me able to override the files from external. After the scripting of database is done, i will do a workspace.PendEdit and workspace.PendAdd.
This works as expected. But workspace.PendDelete does not find deleted files, and therefore cannot adding theses as deleted to the pending changes.
There is a commeandline tool from power tools for tfs which has a online flag which should do that, what i wan.
My Question: is it possible to do, what i described with the tfs-api? If this wont working, has anybody expierence with this online-flag?
Simple Example
I have two files in a local folder: 1.sql and 2.sql These two files are checked in initially.
I delete 2.sql local (without knowledge of tfs) I add one file: 3.sql I edit 1. sql
Now, i use workspace.PendEdit and workspace PendAdd to detect edited and added files. These files will be detected just fine.
And here is the problem: the deletion oder the missing of 2.sql will not be detected and therefore cannot be deleted on the server.
So: how to detect missing files / locally deleted files without knowledge of tfs?
I hope this clarifies my question.
Pseudo code example:
DeleteWorkspaceFolderContent(); // Because i do not delete but regenerate my Sql scripts.
GenerateSqlScriptsToWorkspaceFolder(); // .sql files are generated to the same folder, they were deleted before
// Now at this point, i did workspace.PendAdd(localPath, true);
and workspace.PendEdit(localPath, RecursionType.Full);
which worked like a sharm, so new .sql files will be pended for adding and edited (real changed scripts) pended for "change-Checkin".
// At this point i tought workspace.PendDelete(new [] { localPath }, RecurstionType.Fulll);
does the same: Seeing that a file is locally missing and then pend this files for deletion on the server. But this does not happen. No pending changes are added.
var pendingChanges = workspace.GetPendingChanges(localPath, RecursionType.Full);
workspace.CheckIn(pendingChanges, "Per TFS-API, " + DateTime.Now.ToString());