Get a list of branches from the repository
Namespace: Perforce.P4Assembly: p4api.net (in p4api.net.dll) Version: 2017.3.160.836 (2017.3.160.0836)
Syntax
C# |
---|
public IList<BranchSpec> GetBranchSpecs( Options options ) |
Visual Basic |
---|
Public Function GetBranchSpecs ( _ options As Options _ ) As IList(Of BranchSpec) |
Visual C++ |
---|
public: IList<BranchSpec^>^ GetBranchSpecs( Options^ options ) |
Parameters
- options
- Type: Perforce.P4..::..Options
Return Value
A list containing the matching branches
Remarks
p4 help branches
branches -- Display list of branch specifications
p4 branches [-t] [-u user] [[-e|-E] nameFilter -m max]
Lists branch specifications. (See 'p4 help branch'.)
The -t flag displays the time as well as the date.
The -u user flag lists branch specs owned by the specified user.
The -e nameFilter flag lists branch specs with a name that matches
the nameFilter pattern, for example: -e 'svr-dev-rel*'. The -e flag
uses the server's normal case-sensitivity rules. The -E flag makes
the matching case-insensitive, even on a case-sensitive server.
The -m max flag limits output to the specified number of branch specs.
Examples
To get all branches and include timestamps [-t] (WARNING, will fetch all branches from the repository):
CopyC#
To get branches owned by 'Bob' [-u]:
CopyC#
To get the first 10 branches that start with the capital letter 'A' [-m] [-e]:
CopyC#
To get the first 10 branches that start with the letter 'A' case insensitive [-m] [-E]:
CopyC#
![](../icons/CopyCode.gif)
Options opts = new Options(BranchSpecsCmdFlags.Time, "", "", -1); IList<Branch> branches = _repository.GetBranchSpecs(opts);
![](../icons/CopyCode.gif)
Options opts = new Options(BranchSpecsCmdFlags.None, "Bob", "", -1); IList<Branch> branches = _repository.GetBranchSpecs(opts);
![](../icons/CopyCode.gif)
Options opts = new Options(BranchSpecsCmdFlags.None, "", "A*", 10); IList<Branch> branches = _repository.GetBranchSpecs(opts);
![](../icons/CopyCode.gif)
Options opts = new Options(BranchSpecsCmdFlags.IgnoreCase, "", "A*", 10); IList<Branch> branches = _repository.GetBranchSpecs(opts);