[p4] Obtain a clean workspace [Re: Is there a way to audit a workspace?]
rhsk at ravenbrook.com
Tue Aug 18 08:53:17 PDT 2009
(Note change of topic, from auditing an existing workspace, to
obtaining a new clean one).
On 2009-08-18Tue, at 04:31, Slava Imeshev wrote:
>> p4 sync -f a bullet-proof way of having a clean build
>> workspace, which is a good idea for release/QA builds.
> I should have mentioned that "bullet-proof" implied emptying
> the build workspace before running p4 sync -f.
"sync -f" DOES NOT overwrite open files. If you want to obtain a
clean workspace, you must revert all open files first, or no amount of
syncing will help you.
(And, even worse, when you have an open file, "p4 sync -f" gives a
potentially misleading report of "myfile.txt - file(s) up-to-date." --
try it! Your p4 version may differ...)
To obtain a clean workspace, starting from nothing, one suitable
1. p4 revert mywork/...
2. rm -rf mywork
3. p4 sync -f mywork/... at NNN
Discussion: The "revert" is necessary to close any p4-opened files.
You probably want to check for them with "p4 opened mywork/..." before
blindly reverting them all! For anyone who doesn't speak Unix, the
"rm -rf" removes the "mywork" directory and everything it contains.
(One more note: If you are doing this from a script, and relying on it
for a product that carries your reputation, then you had better also
make sure your script checks for and halts if there are any errors
from the p4 commands, such as from the network going down!)
Again: this is the procedure I use, to obtain a small clean workspace
from scratch; corrections or improvements are welcomed.
More information about the perforce-user