p4 copy
Copy files and/or the stream spec from one location in the depot to another.
Syntax
p4 [g-opts] copy [-c change] [-n -f -K -v -q] [-m max] fromFile[rev] toFile p4 [g-opts] copy [-c change] [-n -f -K -v -q] [-m max] -b branch [-r] [toFile[rev] ...] p4 [g-opts] copy [-c change] [-n -f -K -v -q] [-m max] -b branch -s fromFile[rev] [toFile ...] p4 [g-opts] copy [-c change] [-n -f -K -v -q] [-m max] -S stream [-P parent] [-Fr] [toFile[rev] ...] p4 [g-opts] copy [options] -S stream [-Af | -As] [-P parent] [-F] [-r] [toFile[rev] ...]
Description
Using the client workspace as a staging area, the p4
copy
command propagates an exact copy of the source files
to the specified target by branching, replacing, or deleting files. No
manual resolve is required. Changes in the target that were not
previously merged into the source are overwritten. To update the target,
submit the files. To revert copied files, use the p4 revert
command.
Target files that are identical to the source are not affected by the
p4 copy
command unless you use the -f
option. When p4 copy
creates or modifies files in the
workspace, it leaves them read-only. You can use p4 edit
to make them
writable.
This command also works with openable stream specifications. p4 copy -S stream is described in the Options section.
In most cases, p4 copy
command performs a lazy copy A method used by Helix Core Server to make internal copies of files without duplicating file content in the depot. A lazy copy points to the original versioned file (depot file). Lazy copies minimize the consumption of disk space by storing references to the original file instead of making additional copies of the file.. The contents of the file are not duplicated on the server because the integration record contains sufficient information to reproduce the file.
Options
|
Specify a branch view to be used to determine source and target files. |
||||
|
Open the files in the specified pending changelist rather than in the default changelist. |
||||
|
Force the creation of extra revisions in order to explicitly record that files have been copied. Deleted source files are copied if they do not exist in the target, and files that are already identical are copied if they are not connected by existing integration records. |
||||
|
Force copy operation; perform the operation when the target
stream is not configured to accept a copy of the source. To
determine a stream’s expected flow of change, use |
||||
|
Specify the maximum number of files to copy, to limit the size of the operation. |
||||
-K
|
Suppress keyword expansion when updating +k type files on the client. See File type modifiers. | ||||
|
Preview the copy. |
||||
|
Specify a target stream other than the parent of the source
stream. Requires |
||||
|
Quiet mode, which suppresses normal output messages about the list of files being integrated, copied, or merged. Messages regarding errors or exceptional conditions are displayed. |
||||
|
Reverse the mappings in the branch view, integrating from the
target files to the source files. Requires the |
||||
|
Treat |
||||
|
Causes p4 copy to use a generated branch view that maps the stream to its parent and copy from a stream to its parent. To reverse the copy direction, use -r with -S. Copies the source stream spec propagatable fields into the target stream spec and opens for edit both the target stream spec and the stream files. However, you can specify:
Note that to submit copied stream files, the current client must be switched to the target stream or to a virtual child stream of the target stream. |
||||
|
Do not sync the target files. By default, If a large number of files is involved and you do not require
the files to be present in your workspace, you can minimize
overhead and network traffic by specifying |
||||
|
See Global options. |
Usage notes
Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required |
---|---|---|
|
No |
read access for fromFile |
You can use a revision specifier to select the revision to copy; by
default, the head revision is copied. The revision specifier can be used
on fromFile
or toFile
, but not on
both. When used on toFile
, it refers to source
revisions, not to target revisions. You cannot use a range as a revision
specifier.
Examples
|
Create a stream quickly (without checking integration history) |
p4 copy //projectX/dev/... //projectX/main/... | Promote work from a development stream to the mainline |
Related commands
Update a child stream with a more stable parent stream |
|
Propagate changes after considering all integration history |