Previous Table of Contents Index Next
Perforce 2009.1: Command Reference



p4 edit
Synopsis
Opens file(s) in a client workspace for edit.
Syntax
p4 [g-opts] edit [-c changelist#] [-n] [-t type] file...
Description
p4 edit opens files for editing within the client workspace. The specified file(s) are linked to a changelist, but the files are not actually changed in the depot until the changelist is sent to the server by 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) is 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. (Or use the p4 change command to move files from the default changelist to a numbered changelist.)
To move files already opened for edit from one changelist to another, use p4 reopen.
Options
-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.
Stores the new file revision as the specified type, overriding the file type of the previous revision of the same file. See the File Types section for a list of file types.
Usage Notes
Can File Arguments Use
Revision Specifier?
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:
1.
Use p4 edit to open the file in the client workspace,
2.
3.
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, you muse use p4 resolve before the file can be stored in the depot with p4 submit.
By default, Perforce does not prevent users from opening files that are already open; its default scheme is to allow multiple users to edit the file simultaneously, and then resolve file conflicts with p4 resolve. To determine whether or not another user already has a particular file opened, use p4 opened -a file.
If you need to prevent other users from working on files you've already opened, you can either use the p4 lock command (to allow other users to edit files you have open, but prevent them from submitting the files until you first submit your changes), or you can use the +l (exclusive-open) filetype to prevent other users from opening the files for edit at all.
In older versions of Perforce, p4 edit was called p4 open.
Examples
Opens all files ending in .txt within the current directory's doc subdirectory for edit. These files are linked to the default changelist; these files are stored as type text with keyword expansion.
Implements pessimistic locking (exclusive-open) for all files in a depot. After this changelist is submitted, only one user at a time will be able to edit files in the depot named depotname.
Opens all files anywhere within the current working directory's file tree for edit. These files are examined to determine whether they are text or binary, and changes to these files are linked to changelist 14.
Related Commands
 


Previous Table of Contents Index Next

Perforce 2009.1: Command Reference
Copyright 1999-2009 Perforce Software.