Opens file(s) in a client workspace for edit
p4 edit opens files for editing within the client workspace. The specified file(s) are linked to a changelist; the files are not actually changed within the depot until the changelist is sent to the server with p4 submit.
Perforce controls the local OS file permissions; when p4 edit is run, the OS write permission is turned on for the specified files.
When a file that has been opened for edit with p4 edit is submitted to the depot, the file revision that exists in the depot is not replaced; instead, the new file revision is assigned the next revision number in sequence, and previous revisions are still accessible. By default, the newest revision (the head revision) will be used by all commands that refer to the file.
By default, the specified files are added to the default changelist. Use -c to specify a different changelist.
If p4 edit is run on any files that are already opened for edit, these files are simply moved into the specified changelist, which must have a status of pending.
-c change# | Opens the files for edit within the specified changelist. If this flag is not provided, the files are linked to the default changelist. |
-t type | Stores the new file revision as the specified type, overriding the file type of the previous revision of the same file. Please see the File Types chapter for a list of Perforce file types. |
g_opts | See global options section. |
Can File Arg Use Revision Specifier? |
Can File Arg Use Revision Range? |
Minimal Access Level Required |
---|---|---|
No | No | open |
Since p4 edit turns local OS write permissions on for the specified files, this command should be given before the file is actually edited. The process is:
To edit an older revision of a file, use p4 sync to retrieve the previously stored file revision into the client workspace, and then p4 edit the file. Since this file revision is not the head revision, p4 resolve must be performed before the file can be stored in the depot with p4 submit.
Perforce does not prevent users from opening already-open files; its default scheme is to allow multiple users to edit the file simultaneously, and then resolve file conflicts with p4 resolve. To prevent someone else from opening a file once you've opened it, use p4 lock. To determine whether or not another user already has a particular file opened, use p4 opened -a file.
In older versions of Perforce, p4 edit was called p4 open.
To open a file for add | p4 add |
To open a file for deletion | p4 delete |
To copy all open files to the depot | p4 submit |
To read files from the depot into the client workspace | p4 sync |
To create or edit a new changelist | p4 change |
To list all opened files | p4 opened |
To revert a file to its unopened state | p4 revert |
To move an open file to a different changelist | p4 reopen |