Tag depot files with the passed-in label.

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

Syntax

C#
public IList<FileSpec> TagFiles(
	IList<FileSpec> filespecs,
	string labelid,
	Options options
)
Visual Basic
Public Function TagFiles ( _
	filespecs As IList(Of FileSpec), _
	labelid As String, _
	options As Options _
) As IList(Of FileSpec)
Visual C++
public:
IList<FileSpec^>^ TagFiles(
	IList<FileSpec^>^ filespecs, 
	String^ labelid, 
	Options^ options
)

Parameters

filespecs
Type: System.Collections.Generic..::..IList<(Of <(<'FileSpec>)>)>
labelid
Type: System..::..String
options
Type: Perforce.P4..::..Options

Return Value

Remarks


p4 help tag

tag -- Tag files with a label

p4 tag [-d -n] -l label file[revRange] ...

Tag associates the named label with the file revisions specified by
the file argument. After file revisions are tagged with a label,
revision specifications of the form '@label' can be used to refer
to them.

If the file argument does not include a revision specification, the
head revisions is tagged. See 'p4 help revisions' for revision
specification options.

If the file argument includes a revision range specification, only
the files with revisions in that range are tagged. Files with more
than one revision in the range are tagged at the highest revision.

The -d deletes the association between the specified files and the
label, regardless of revision.

The -n flag previews the results of the operation.

Tag can be used with an existing label (see 'p4 help labels') or
with a new one. An existing label can be used only by its owner,
and only if it is unlocked. (See 'p4 help label').

To list the file revisions tagged with a label, use 'p4 files
@label'.

Examples

To tag the file //depot/MyCode/README.txt with build_label:
CopyC#
TagCmdOptions opts = 
new TagCmdOptions(TagFilesCmdFlags.None, null);

FileSpec filespec =
new FileSpec(new DepotPath("//depot/MyCode/README.txt"), null);
IList<FileSpec> filespecs = new List<FileSpec>();
filespecs.Add(filespec);

IList<FileSpec> target =
Repository.TagFiles(filespecs, "build_label", opts);
To remove the association between the file //depot/MyCode/README.txt and build_label:
CopyC#
TagCmdOptions opts = 
new TagCmdOptions(TagFilesCmdFlags.Delete, null);

FileSpec filespec =
new FileSpec(new DepotPath("//depot/MyCode/README.txt"), null);
IList<FileSpec> filespecs = new List<FileSpec>();
filespecs.Add(filespec);

IList<FileSpec> target =
Repository.TagFiles(filespecs, "build_label", opts);
To get a preview list of the files that would be tagged in path //depot/main/src with build_label:
CopyC#
TagCmdOptions opts = 
new TagCmdOptions(TagFilesCmdFlags.ListOnly, null);

FileSpec filespec =
new FileSpec(new DepotPath("//depot/main/src/..."), null);
IList<FileSpec> filespecs = new List<FileSpec>();
filespecs.Add(filespec);

IList<FileSpec> target =
Repository.TagFiles(filespecs, "build_label", opts);

See Also