Click or drag to resize

ClientShelveFiles Method (Options, FileSpec)

Namespace:  Perforce.P4
Assembly:  p4api.net (in p4api.net.dll) Version: 2023.2.258.5793
Syntax
public IList<FileSpec> ShelveFiles(
	Options options,
	params FileSpec[] files
)

Parameters

options
Type: Perforce.P4Options
files
Type: Perforce.P4FileSpec

Return Value

Type: IListFileSpec
Remarks

p4 help shelve

shelve -- Store files from a pending changelist into the depot

p4 shelve [-p] [files]
p4 shelve [-a option] [-p] -i [-f | -r]
p4 shelve [-a option] [-p] -r -c changelist#
p4 shelve [-a option] [-p] -c changelist# [-f] [file ...]
p4 shelve -d -c changelist# [-f] [file ...]

'p4 shelve' creates, modifies or deletes shelved files in a pending
changelist. Shelved files remain in the depot until they are deleted
(using 'p4 shelve -d') or replaced by subsequent shelve commands.
After 'p4 shelve', the user can revert the files and restore them
later using 'p4 unshelve'. Other users can 'p4 unshelve' the stored
files into their own workspaces.

Files that have been shelved can be accessed by the 'p4 diff',
'p4 diff2', 'p4 files' and 'p4 print' commands using the revision
specification '@=change', where 'change' is the pending changelist
number.

By default, 'p4 shelve' creates a changelist, adds files from the
user's default changelist, then shelves those files in the depot.
The user is presented with a text changelist form displayed using
the editor configured using the $P4EDITOR environment variable.

If a file pattern is specified, 'p4 shelve' shelves the files that
match the pattern.

The -i flag reads the pending changelist specification with shelved
files from the standard input. The user's editor is not invoked.
To modify an existing changelist with shelved files, specify the
changelist number using the -c flag.

The -c flag specifies the pending changelist that contains shelved
files to be created, deleted, or modified. Only the user and client
of the pending changelist can add or modify its shelved files. Any
files specified by the file pattern must already be opened in the
specified changelist; use 'p4 reopen' to move an opened file from
one changelist to another.

The -f (force) flag must be used with the -c or -i flag to overwrite
any existing shelved files in a pending changelist.

The -r flag (used with -c or -i) enables you to replace all shelved
files in that changelist with the files opened in your own workspace
at that changelist number. Previously shelved files will be deleted.
Only the user and client workspace of the pending changelist can
replace its shelved files.

The -a flag enables you to handle unchanged files similarly to some
client submit options, namely 'submitunchanged' and 'leaveunchanged'.
The default behavior of shelving all files corresponds to the
'submitunchanged' option. The 'leaveunchanged' option only shelves
changed files, and then leaves the files opened in the pending
changelist on the client.

The -d flag (used with -c) deletes the shelved files in the specified
changelist so that they can no longer be unshelved. By default, only
the user and client of the pending changelist can delete its shelved
files. A user with 'admin' access can delete shelved files by including
the -f flag to force the operation.

The -p flag promotes a shelved change from an edge server to a commit
server where it can be accessed by other edge servers participating
in the distributed configuration. Once a shelved change has been
promoted, all subsequent local modifications to the shelf are also
pushed to the commit server and remain until the shelf is deleted.
Once a shelf has been created, the combination of flags '-p -c' will
promote the shelf without modification unless '-f' or '-r' are also
used to update the shelved files before promotion.

'p4 shelve' is not supported for files with propagating attributes
from an edge server in a distributed environment.

See Also