p4 copy

Synopsis

Copy files from one location in the depot to another.

Syntax

p4 [g-opts] copy [-c change] [-n -f -v -q] [-m max] fromFile[rev] toFile
p4 [g-opts] copy [-c change] [-n -f -v -q] [-m max] -b branch [-r] [toFile[rev] ...]
p4 [g-opts] copy [-c change] [-n -f -v -q] [-m max] -b branch -s fromFile[rev] [toFile ...]
p4 [g-opts] copy [-c change] [-n -f -v -q] [-m max] -S stream [-P parent] [-Fr]
                 [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.

Options

-b branch

Specify a branch view to be used to determine source and target files.

-c change

Open the files in the specified pending changelist rather than in the default changelist.

-f

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.

-F

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 p4 istat.

-m max

Specify the maximum number of files to copy, to limit the size of the operation.

-n

Preview the copy.

-P parent

Specify a target stream other than the parent of the source stream. Requires -S.

-q

Quiet mode; suppress normal output messages about the list of files being integrated, copied, or merged. Messages regarding errors or exceptional conditions are displayed.

-r [toFile[rev] ...]

Reverse the mappings in the branch view, integrating from the target files to the source files. Requires the -b option.

-s fromFile[rev] [toFile ...]

Treat fromFile as the source and both sides of the branch view as the target. To restrict the scope of the target further, specify the optional toFile parameter. Overrides the -r option, if specified. Requires -b.

-S stream

Specify the source stream. Changes are copied to its parent. You can use the -r option to reverse direction. 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.

-v

Do not sync the target files. By default, p4 copy syncs the target files.

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 -v.

g-opts

See “Global Options”.

Usage Notes

Can File Arguments Use Revision Specifier? Can File Arguments Use Revision Range? Minimal Access Level Required

fromFile: Yes
toFile: No

No

read access for fromFile
open access for toFile

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 may not use a range as a revision specifier.

Examples

p4 copy -S //projectX/dev/...

Promote work from a development stream to the mainline.

Related Commands

Update a child stream with a more stable parent stream

p4 merge

Propagate changes

p4 integrate