Processing data from the server

Helix Core 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 Core 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 Core Server commands can return tagged output.

Note

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 Core Server, set the api variable according to the notes for SetProtocol().

p4 add

p4 attribute

p4 branch -o

p4 branches

p4 change -o

p4 changes

p4 client -o

p4 clients

p4 counter

p4 counters

p4 delete

p4 depots

p4 describe

p4 diff - (summary line)

p4 diff2

p4 edit

p4 filelog

p4 files

p4 fix

p4 fixes

p4 group -o

p4 groups

p4 have

p4 info - can indicate enabled for the fields password, monitor, security, and unicode

p4 integrate

p4 integrated

p4 interchanges

p4 job -o

p4 jobs

p4 jobspec -o

p4 label -o

p4 labels

p4 labelsync

p4 lock

p4 logger

p4 monitor

p4 obliterate

p4 print

p4 protect -o

p4 reopen

p4 resolve -at, p4 resolve -ay, p4 resolve -n

p4 revert

p4 review

p4 reviews

p4 submit

p4 sync

p4 triggers -o

p4 typemap -o

p4 unlock

p4 user -o

p4 users - can indicate that the password field is set to enabled

p4 verify

p4 where

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().