Processing data from the server
Helix Server can return tagged data (name-value pairs) for some commands. The following sections tell you how to handle tagged and untagged data.
Tagged data
The following example shows data returned in tagged format by
p4 -Ztag clients
command. (The -Z flag specifies that
tagged data is to be returned; this flag is unsupported and intended for
debugging use.)
...client xyzzy ...Update 972354556 ...Access 970066832 ...Owner gerry ...Host xyzzy ...Description Created by gerry
To enable the Helix Server to return tagged data, your application must call SetProtocol("tag",
"")
before connecting to the server. To extract values
from tagged data, use the GetVars
method.
List of commands that can output tagged data
The following Helix Server commands can return tagged output.
The tagged output of some commands can changed across releases. For complete details, see the release notes for your version, such as: https://www.perforce.com/perforce/r18.1/user/p4devnotes.txt where r18.1 represents the 2018.1 release.
To obtain output in the form used by earlier revisions of
Helix Server, set
the api variable according to the notes for SetProtocol()
.
p4 branch -o
p4 change -o
p4 client -o
p4 diff - (summary line)
p4 group -o
p4 info - can indicate enabled for the fields password, monitor, security, and unicode
p4 job -o
p4 jobspec -o
p4 label -o
p4 protect -o
p4 resolve -at, p4 resolve -ay, p4 resolve -n
p4 triggers -o
p4 typemap -o
p4 user -o
p4 users - can indicate that the password field is set to enabled
Untagged Data
To handle untagged data, create a subclass of ClientUser
for every type of data required and provide alternate implementations of
ClientUser::OutputInfo()
,
OutputBinary()
,
OutputText()
, and
OutputStat()
.