Namespace: Perforce.P4
Assembly: p4api.net (in p4api.net.dll) Version: 2015.1.103.4687 (2015.1.103.4687)

Syntax

C#
public IList<FileSpec> CopyFiles(
	Options options,
	FileSpec fromFile,
	params FileSpec[] toFiles
)
Visual Basic
Public Function CopyFiles ( _
	options As Options, _
	fromFile As FileSpec, _
	ParamArray toFiles As FileSpec() _
) As IList(Of FileSpec)
Visual C++
public:
IList<FileSpec^>^ CopyFiles(
	Options^ options, 
	FileSpec^ fromFile, 
	... array<FileSpec^>^ toFiles
)

Parameters

options
Type: Perforce.P4..::..Options
fromFile
Type: Perforce.P4..::..FileSpec
toFiles
Type: array<Perforce.P4..::..FileSpec>[]()[][]

Return Value

Remarks


p4 help copy

copy -- Copy one set of files to another

p4 copy [options] fromFile[rev] toFile
p4 copy [options] -b branch [-r] [toFile[rev] ...]
p4 copy [options] -b branch -s fromFile[rev] [toFile ...]
p4 copy [options] -S stream [-P parent] [-F] [-r] [toFile[rev] ...]

options: -c changelist# -n -v -m max

'p4 copy' copies one set of files (the 'source') into another (the
'target').

Using the client workspace as a staging area, 'p4 copy' makes the
target identical to the source by branching, replacing, or deleting
files. 'p4 submit' submits copied files to the depot. 'p4 revert'
can be used to revert copied files instead of submitting them. The
history of copied files can be shown with 'p4 filelog' or 'p4
integrated'.

Target files that are already identical to the source, or that are
outside of the client view, are not affected by 'p4 copy'. Opened,
non-identical target files cause 'p4 copy' to exit with a warning.
When 'p4 copy' creates or modifies files in the workspace, it leaves
them read-only; 'p4 edit' can make them writable. Files opened by
'p4 copy' do not need to be resolved.

Source and target files (fromFile and toFile) can be specified on
the 'p4 copy' command line or through a branch view. On the command
line, fromFile is the source file set and toFile is the target file
set. With a branch view, one or more toFile arguments can be given
to limit the scope of the target file set.

A revision specifier can be used to select the revision to copy; by
default, the head revision is copied. The revision specifier can be
used on fromFile, or on toFile, but not on both. When used on toFile,
it refers to source revisions, not to target revisions. A range may
not be used as a revision specifier. For revision syntax, see 'p4
help revisions'.

The -S flag makes 'p4 copy' use a stream's branch view. (See 'p4 help
stream'.) The source is the stream itself, and the target is the
stream's parent. With -r, the direction is reversed. -P can be used
to specify a parent stream other than the stream's actual parent.
Note that to submit copied stream files, the current client must
be dedicated to the target stream. (See 'p4 help client'.)

The -F flag can be used with -S to force copying even though the
stream does not expect a copy to occur in the direction indicated.
Normally 'p4 copy' enforces the expected flow of change dictated
by the stream's spec. The 'p4 istat' command summarizes a stream's
expected flow of change.

The -b flag makes 'p4 copy' use a user-defined branch view. (See
'p4 help branch'.) The source is the left side of the branch view
and the target is the right side. With -r, the direction is reversed.

The -s flag can be used with -b to cause fromFile to be treated as
the source, and both sides of the user-defined branch view to be
treated as the target, per the branch view mapping. Optional toFile
arguments may be given to further restrict the scope of the target
file set. -r is ignored when -s is used.

The -c changelist# flag opens files in the designated (numbered)
pending changelist instead of the default changelist.

The -n flag displays a preview of the copy, without actually doing
anything.

The -m flag limits the actions to the first 'max' number of files.

The -v flag causes a 'virtual' copy that does not modify client
workspace files. After submitting a virtual integration, 'p4 sync'
can be used to update the workspace.

See Also