p4 add
Open files in a client workspace for addition to the depot.
Syntax
p4 [g-opts] add [-c changelist] [-d -f -I -n] [-t filetype] file ...
Description
p4 add opens files within the client workspace for
addition to the depot. The specified files are linked to a changelist.
The command can
add files to a new, empty depot or to a depot that already contains files. The files are added to the depot when the changelist is
committed with p4
submit
. The added files must either not already
exist in the depot, or be marked as deleted at the
head revision.
p4 add *
is equivalent to p4 reconcile -a
*
.
To open a file with p4 add
, the file must exist in
your client view, but does not need to exist in your workspace at the
time of p4 add
. The file must exist in your
workspace when you run p4
submit
. If not, the submission fails.
p4
add
does not create or overwrite files in your workspace.
If a file does not exist, you must create it yourself.
By default, the specified files are opened in the default changelist. To
open the files in a specified changelist, use the -c
option.
To move files from the default changelist to a numbered changelist, use
the p4 change
command.
By default, p4 add
skips over files mentioned in any
applicable P4IGNORE
files. To
override this behavior, use the -I
option to ignore the
contents of any P4IGNORE
files.
When adding files,
the command first examines the typemap table (p4
typemap
) to see if the system administrator has
defined a file type for the files being added. If a match is found, the
file’s type is set as defined in the typemap table. If a match is
not found,
the command examines the first bytes of the file based on the
filesys.binaryscan configurable (by default, 65536 bytes) to
determine whether it is text
or binary
, and the
files are stored in the depot accordingly. By default, text file
revisions are stored in reverse delta format. Newly-added text files
larger than the limit imposed by the filetype.maxtextsize
configurable (by default, 10 MB) are assigned filetype
text+C
and stored in full. Files compressed in the
.zip
format (including .jar
files) are also
automatically detected and assigned the type ubinary
. Other
binary revisions are stored in full, with compression.
The -t filetype
option explicitly specifies a file
type, overriding both the typemap table and
the
default file type detection mechanism.
To add files containing the characters @
, #
,
*
, and %
, use the -f
option. This
option forces literal interpretation of characters otherwise used by Helix Core Server as wildcards.
If you open a file for edit or move/add, and another user subsequently
deletes the file you opened, the operation will fail with an error when
you submit the changelist. To ensure that you create the desired target
file, specify the -d
option ("downgrade"). More
specifically:
- You open a file for edit, then another user submits a changelist that
deletes or moves the file. When you submit your edits,
Helix Core Server
returns an error and the file remains open for edit. To restore the
file (including any changes you have made) to the depot location from
which you checked it out, open the file for add and specify the
-d
option, then submit the file. - You open a file for move/add and another user submits a changelist
that deletes the source file. When you submit the move,
Helix Core Server
returns an error and the file remains open for add/move. To create the
desired target file, issue the
p4 add -d
command, specifying the target file, and submit the file.
Options
|
Opens the files for |
|
Downgrade file open status to simple add. |
|
Use the |
|
Do not perform any ignore checking; ignore any settings
specified by |
|
Preview which files would be opened for add, without actually changing any files or metadata. |
|
Adds the file as the specified filetype, overriding any settings in the typemap table. See File types as well as the lbr.autocompress configurable. |
|
See Global options. |
Usage notes
Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required |
---|---|---|
No |
No |
|
- The local operating system expands the * wildcard (see Wildcards)
in file specifications provided to
p4 add
. -
Do not use ASCII expansions of special characters with
p4 add -f
. To add the file[email protected]
, use:p4 add -f [email protected]
If you manually expand the
@
sign and attempt to add the filestatus%40june.txt
, Helix Core Server interprets the%
sign literally, expands it to the hex code%25
, resulting in the filenamestatus%2540june.txt
. -
See also Default ignored paths in the p4 ignores topic.
Examples
|
Assigns a specific file type to a new file, overriding any settings in the typemap table. |
p4 add -t text+D fileA.txt | Stores the specified file in RCS format, which is uncompressed and, for this file, overrides the default setting of the lbr.autocompress configurable. |
|
Opens all the files within the user’s current directory for
|
|
|
|
Opens a file named To refer to this file in views, or with other
commands, you must subsequently use the hex expansion
For more information, see Limitations on characters in filenames and entities. |
Related commands
To open a file for edit, including to override its file type |
|
To open a file for deletion |
|
To move (rename) a file |
|
To copy all open files to the depot |
|
To read files from the depot into the client workspace |
|
To create or edit a new changelist |
|
To change default behavior of text and binary file detection |
|
To list all opened files |
|
To revert a file to its unopened state |
|
To move an open file to a different pending changelist |
|
To change an open file’s file type |
|