Jump to content
Michael Buchoff

Fully cleaning a changeset

Recommended Posts

As part of our automated build process, we want to undo all changes and delete all added files (ignored and hidden) before building so that we're starting from a completely clean changeset.  We've experimented with various cm.exe options, but haven't found any combination that does what we're trying to do.

As a workaround, we typically delete the entire directory (with rmdir /s /q) and check it back out, but occasionally the directory doesn't delete successfully; one of the background processes such as an antivirus or plasticscmshellextensionproxy.exe probably has lock on it.

What's the preferred way to completely clean a changeset?

Thanks in advance.

Share this post

Link to post
Share on other sites

Wow, thanks for the fast response!

When I tried cm unco --allit undid all my changes, but didn't delete all the private, hidden, and ignored files.  When typing cm unco --help, the help text doesn't mention the --all switch, so maybe there's a way to ask for this as well?

Edit:  cm version tells me I'm running

Share this post

Link to post
Share on other sites

Hi @Michael Buchoff,

I'm afraid plastic will never delete your private files but you can search them and get rid of them.

For ignored private files you can do the following:

@echo off
    setlocal enableextensions disabledelayedexpansion

    for /f "delims=" %%a in ('cm status --private --short') do del /q "%%a"

Yes, a little tricky since the del command can't be piped (AFIK).

You can combine the ignore and private search by using the two flags at once: --ignored --private

Hope it helps!

Share this post

Link to post
Share on other sites

So we finally got around to applying the script above and it seems to almost work.  There's a delay of a few minutes, followed by a long list of del command deleting the ignored files/directories.  Unfortunately, the final del command is:



del /q "Finding changed files took too long. Perf tips: https://www.plasticscm.com/download/help/statusperfhintschanged"


Apparently, there's a built-in time limit for the cm status command to run.  Is there an option to turn that time limit off?

Share this post

Link to post
Share on other sites

In case it helps anyone, there's a flag


that can be combined with


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


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...