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:

  1. Bruno opens file for edit.
  2. Gale opens the same file in her client for edit.
  3. Bruno and Gale both edit their client workspace versions of the file.
  4. Bruno submits a changelist containing that file, and his submit succeeds.
  5. Gale submits a changelist with her version of the file; her submit fails because of file conflicts with the new depot’s file.
  6. Gale starts a resolve.
  7. Bruno edits and submits a new version of the same file.
  8. 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.

  1. Before scheduling a resolve, lock the file.
  2. Sync the file (to schedule a resolve).
  3. Resolve the file.
  4. Submit the file.
  5. Helix Core Server automatically unlocks the file after successful changelist submission.

To list open locked files on UNIX, issue the following command:

p4 opened | grep "*locked*"