p4 unlock (graph)

Release a locked file, leaving it open.

Syntax

p4 unlock [-c changelistNumber -f file ...]

Syntax conventions

Description

p4 unlock releases locks on the specified files.

If no file specification is given and no changelist is specified, all open files are unlocked.

The changelist flag and file specification limit the files to be unlocked:

  • If a changelist is specified, only those files open in that changelist are unlocked.
  • If a file specification is given, only those files are unlocked.
  • If both changelist and file specification are provided, only the matching files in the specified changelist are unlocked.

Options

-c changelist

Applies to opened files in a pending changelist locked by p4 lock or by a failed submit.

-f

Enables you to unlock files in changelists owned by other users. This option requires super access, granted by p4 protect or admin permission on the affected repos.

Note

By default, files can be unlocked only by the changelist owner, who must also be the person who has the files locked.

Usage Notes

Can File Arguments Use Revision Specifier? Can File Arguments Use Revision Range? Minimal Access Level Required

No

No

read permission for the repo.

admin permission to unlock with the -f option.

Example

$ p4 edit ...
//repo/main/src/foo.c - opened for edit
//repo/main/src/bar.c - opened for edit
//repo/main/src/main.c - opened for edit

$ p4 lock ...
//repo/main/src/foo.c - locking

//repo/main/src/bar.c - locking

//repo/main/src/main.c - locking

$ p4 opened ...

//repo/main/src/foo.c#none - edit default change (text) *locked*

//repo/main/src/bar.c#none - edit default change (text) *locked*

//repo/main/src/main.c#none - edit default change (text) *locked*

$ p4 unlock ...

//repo/main/src/foo.c - unlocking

//repo/main/src/bar.c - unlocking

//repo/main/src/main.c - unlocking

$ p4 opened ...

//repo/main/src/foo.c#none - edit default change (text)

//repo/main/src/bar.c#none - edit default change (text)

//repo/main/src/main.c#none - edit default change (text)

Other users can open locked files for edit, but will not be able to submit them:

$ p4 -u user2 submit -d edit_of_locked_files

//repo/main/src/foo.c - already locked by bruno@prc7

//repo/main/src/bar.c - already locked by bruno@prc7

//repo/main/src/main.c - already locked by bruno@prc7

File(s) couldn't be locked.

Submit failed -- fix problems above then use 'p4 submit -c 919'.