Perforce Command Reference:   [Index]  [Prev] [Next]


p4 add

Synopsis

Opens file(s) in a client workspace for addition to the depot

Syntax

p4 [g-opts] add [-c changelist#] [-t type] file...

Description

p4 add opens files within the client workspace for addition to the depot. The specified file(s) are linked to a changelist; the files are not actually added to the depot until the changelist is sent to the server with p4 submit.

The added files must be visible through the user's current client view. These files need not exist within the client workspace at the time of p4 add. However, they must be in the client workspace by the time p4 submit is run, or submission will fail. p4 add does not create the files; they must be created by the user.

The new files must either not already exist in the depot, or can exist in the depot but be deleted at the current head revision. Files may be deleted and re-added arbitrarily.

By default, the specified files are added to the default changelist. Use -c to specify a different changelist. Any files that are already opened for add are simply moved into the specified changelist, which must have a status of pending.

When the -t flag is not provided, Perforce examines each file to determine whether it is text or binary, and the files are stored accordingly. File revisions are stored in reverse delta format if the file is text; the full file revision is stored if the file is binary.

Options

-c change# Opens the files for 'add' within the specified changelist. If this flag is not provided, the files are linked to the default changelist.
-t type Adds the file as the specified type, which must be one of text, ltext, xtext, ktext, kxtext, binary, xbinary, symlink, or resource.
g_opts See global options.

Usage Notes

Can File Arg Use
Revision Specifier?

Can File Arg
Use Revision Range?

Minimal
Access Level Required

No No open

Wildcards in file specifications provided to p4 add are expanded by the local operating system, not by the Perforce server program p4d. Thus, the ... wildcard may not be used with p4 add.

Examples

p4 add -c 13 * Opens all the files within the user's current directory for add; links these files to changelist 13.
p4 add README ~/src/*.c Opens all *.c files in the user's src directory for add; also opens the README file in the user's current working directory for add. These files are linked to the default changelist.

Related Commands

To open a file for edit

p4 edit
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



Perforce Command Reference:   [Index]  [Prev] [Next]


Copyright 1998 Perforce Software.
Contact us at [email protected]
Last updated: 06/14/98