February 9, 2009
Anyone who has used SVN for a while knows that it really, really hates it when you just delete directory structures it has under source control. The reason is the hidden ".svn" folders it creates in each folder of the structure. Once these little hidden directories get deleted, SVN (at least when managed through TortoiseSVN) gets thoroughly confused and starts demanding the you run the "cleanup" command. Of course that also fails. Persoanlly, I would expect it to be smart enough to just re-checkout stuff it thinks is missing or re-sync with what is actually there, but it doesn't.
Normally this isn't a problem since you don't often want to delete your source files en masse anyway. But when you are using a code-generating tool to periodically regenerate a project, it can be a a bit of a pain. After running into this several times after regenerating LLBLGen projects (it is best to flush out the target directory when using LLBLGen since it has a habit of not overwriting certain files), I came up with this sequence of steps that seems to let LLBLGen and SVN play nice together:
- Assuming you generate your project into a directory named "c:\foo", open Windows Explorer and select "c:\foo" in the left pane. All the files and subdirectories beneath "c:\foo" will be displayed in the right pane.
- Highlight all the files and subdirectories in the right pane except the ".svn" folder in "c:\foo" itself (it may be hidden, if so, don't worry about it).
- Then right-click the selected files and folders and chose "Delete" from the TortoiseSVN menu. Commit the changes to SVN.
- Using your code generating tool, regenerate the code into the "c:\foo" directory.
- Test your solution.
- If everything builds properly, open Windows Explorer and select "c:\foo" in the left pane and highlight all the files and subdirectories in the right pane.
- Select "Add" from the TortoiseSVN menu. Commit the changes to SVN. You should be good to go.
Needless to say, this is a destructive process -- if there is anything beneath "c:\foo" that is not regenerated (or that you wish to keep), squirrel it away somewhere safe prior to doing this...