Preventing multiple resolves by locking files
Without file locking, there is no guarantee that the resolve process ever ends. The following scenario demonstrates the problem:
- Bruno opens file for edit.
- Gale opens the same file in her client for edit.
- Bruno and Gale both edit their client workspace versions of the file.
- Bruno submits a changelist containing that file, and his submit succeeds.
- Gale submits a changelist with her version of the file; her submit fails because of file conflicts with the new depot’s file.
- Gale starts a resolve.
- Bruno edits and submits a new version of the same file.
Gale finishes the resolve and attempts to submit; the submit fails and must now be merged with Bruno’s latest file.
…and so on.
To prevent such problems, you can lock files, as follows.
- Before scheduling a resolve, lock the file.
- Sync the file (to schedule a resolve).
- Resolve the file.
- Submit the file.
- Helix server automatically unlocks the file after successful changelist submission.
To list open locked files on UNIX, issue the following command:
$ p4 opened | grep "*locked*"