jitterist Posted October 24, 2016 Report Share Posted October 24, 2016 Hi. Is there a "git clean"-like command for plastic? I recently wanted to delete all unversioned files(Binaries and such) and didn't know what to do. This is a really important feature. Link to comment Share on other sites More sharing options...
mig Posted October 25, 2016 Report Share Posted October 25, 2016 Hi jitterist, There's currently no command that mimics the "git clean" behavior. If you consider that's a must have for you, we'd like you to add your request to our UserVoice site: https://plasticscm.uservoice.com/forums/15467-general As a workaround, you can use the cm status command to list the files you'd like to delete and pipe the output to a for-each-like shell command. For instance, this is how it could be done in PowerShell: cm status --private --short $workspacePath | % { rm $_ } In bash you could either use cm status --private --short ${WORKSPACE_PATH} | while read FILE; do rm $FILE; done or cm status --private --short ${WORKSPACE_PATH} | xargs rm Of course, you can change the --private argument or add any other to fit your needs. For instance, if you'd like to remove all ignored files you can include the --ignored argument in the cm status command. The --short argument makes the cm status command to output just the full paths of the matching files. Is this suitable for you? Please let us know! Regards, Miguel Link to comment Share on other sites More sharing options...
M-Pixel Posted October 18, 2017 Report Share Posted October 18, 2017 `% { rm $_ }` does not work from a cmd file. Also, `rm` will only work on Windows if you've installed unix command line tools, which is not a prerequisite for using Plastic. Many people will not have that command available. Here's a "hard reset.cmd" that I use on Windows: @echo !!!!!!!!!!!!!!!!!!! @echo !!!!! WARNING !!!!! @echo !!!!!!!!!!!!!!!!!!! @echo You are about to delete all ignored and private files. @echo Please make sure that you haven't forgotten to check in or shelve any of them. @pause for /F "usebackq tokens=*" %%I in (`cm status --private --ignored --short .`) do ( del /A /Q "%%I" rmdir /S /Q "%%I" rmdir /S /Q "%%I" ) It's certainly ridiculous, especially the fact that rmdir is required twice in a row, but it's closest I was able to get to removing the files and directories in Windows. And even still, some files could not be deleted with these commands. The script could be simpler if it were a PowerShell script, however that would require some setup in order to run as conveniently as a cmd file. It's slower than it needs to be because if a folder is ignored/private, then this command will waste time deleting each item contained in the folder individually. I think that this is a pretty compelling use case to add a native cm clean command, so I hope Codice reconsiders their response to the former feature request mentioned above. Link to comment Share on other sites More sharing options...
Itadakimas Posted February 9, 2018 Report Share Posted February 9, 2018 Hi ! I tried using the following command to retrieve all private files in the workspace cm status --private --short At the end of the list, there is the following message with breaks the process : You have too many privates and this can affect performance. Learn how to ignore private files: https://www.plasticscm.com/download/help/statusperfhintsignoreprivates Is there a way to remove it ? Link to comment Share on other sites More sharing options...
Itadakimas Posted February 9, 2018 Report Share Posted February 9, 2018 Nevermind cm status --private --short | while read FILE; do [[ -d "$FILE" ]] && rmdir "$FILE"; done cm status --private --short | while read FILE; do [[ -f "$FILE" ]] && rm -v "$FILE"; done Link to comment Share on other sites More sharing options...
Itadakimas Posted February 9, 2018 Report Share Posted February 9, 2018 Well, that didn't work... Link to comment Share on other sites More sharing options...
manu Posted February 14, 2018 Report Share Posted February 14, 2018 I can't find a way to remove the last warning line and preserve the short format. You can do this: cm status --private --machinereadable --startlineseparator="@@" --endlineseparator="@@" --fieldseparator="||" It will not print the warning message but it will give you not only the file path but also extra info. Link to comment Share on other sites More sharing options...
gweronimo Posted February 18, 2020 Report Share Posted February 18, 2020 In case it helps anyone, there's a flag --cutignored that can be combined with --ignored to filter out the contents below ignored directories, thereby simplifying the output. The following command gives a list that can be used directly in a FOR loop : cm status --ignored --cutignored --compact --short Link to comment Share on other sites More sharing options...
sisso Posted December 13, 2021 Report Share Posted December 13, 2021 sorry for the necro, but it is important to highlight to use any command in this thread with caution. `cm` output logs into standard output, even when piped. In my case a `cm status | rm` was causing a plastic dll to be deleted because the following log: Your mono runtime and class libraries are out of sync. The out of sync library is: /opt/plasticscm5/client/clientcommon.dll So never pipe blind to rm -rf or you have a bad day if plastic decide to log where is your home dir Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now