ApexRefreshProject doesn't remove local files that don't exist on remote
Same as title, while in documentation we have the following:
Refresh current project and download new/modified files from SFDC, replacing all local files.
Which for me indicated that all local files will be removed, and new files will be downloaded. Is current behaviour intended?
Hello @kgrzywacz
Which for me indicated that all local files will be removed
No, this is not the case.
Refresh is not supposed to remove files proactively. It does exactly what you quoted - replaces local files, but if no replacement file received from SFDC then local file stays intact.
Perhaps documentation needs to be updated to clarify this... If you have suggestions on alternative wording please let me know.
Hello @neowit,
I think my assumption was wrong. I'm just used to different behaviour for similar commands.
Would it be possible to add new command - ApexCleanProject that would clean all local files in working directory, and then pull metadata from SFDC?
I am not sure about this. The problem is how to determine which files are to be cleaned and which ones are to be kept. Indiscriminate removal of all files in "src" folder may not be what most people want. Besides - vim plugin does not know much about which files are actually salesforce files and which ones are not.
I think a much better/simpler option would be if you wrote your own shell or vim script which removes what you need.
For example - to remove all files in src folder, but keep package.xml and directory structure:
find src/ -type f -not -name 'package.xml' -print0 | xargs -0 rm --