Create a new branch in the repository.

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

Syntax

C#
public BranchSpec CreateBranchSpec(
	BranchSpec branch
)
Visual Basic
Public Function CreateBranchSpec ( _
	branch As BranchSpec _
) As BranchSpec
Visual C++
public:
BranchSpec^ CreateBranchSpec(
	BranchSpec^ branch
)

Parameters

branch
Type: Perforce.P4..::..BranchSpec
Branch specification for the new branch

Return Value

The Branch object if new branch was created, null if creation failed

Examples

To create a basic branch spec:
CopyC#
BranchSpec newBranchSpec = new BranchSpec();
newBranchSpec.Id = "newBranchSpec";
newBranchSpec.ViewMap = new ViewMap();
string v0 = "//depot/main/... //depot/rel1/...";
newBranchSpec.ViewMap.Add(v0);
_repository.CreateBranchSpec(newBranchSpec);

See Also