It's all about the answers!

Ask a question

scm: How to restore a workspace to "pristine"?

Christian Höltje (5810) | asked Feb 06 '14, 1:56 p.m.
How can a restore a workspace to a "pristine" state?  e.g. identical if I just cloned it?

In git, I can do: "git reset .; git checkout .; git clean -xfd" to restore a check out to a pristine state.

How do I do this with the 'scm' command?


My specific requirements are I'm using the Jenkins plugin and want to ensure the workspace is clean before the next build happens. I am currently just blowing everything away and re-loading the workspace, but this is slow.

One answer

permanent link
Shashikant Padur (4.2k27) | answered Feb 06 '14, 11:38 p.m.
scm undo does not allow undoing a directory that has changes to files (defect 119103). A workaround would be to write a script that runs 'scm status' from the root of the sandbox (Use --json option to get the result in json format). This would return all unresolved files and then run 'scm undo' to remove (in case of additions) or undo (in case of modifications) from the file system.

Christian Höltje commented Feb 08 '14, 1:26 p.m.

Will that take care of jazz ignored files too?  Does such a script already exist? 

Shashikant Padur commented Feb 09 '14, 11:38 p.m.

No. It will not take care of ignored files. I am not aware of any script that does this work.

Your answer

Register or to post your answer.