[p4] How to use "--field Description=blah" command in C# API.

Sambwise perforce-user-forum at forums.perforce.com
Thu Mar 30 09:55:01 PDT 2017


Posted on behalf of forum user 'Sambwise'.

The API equivalent of --field is the Spec class.  I've never used
it from the C# API (hopefully it's in there!), but assuming it works
like it does in the C++ API it's pretty simple -- you need to get the
"specdef" string from the server (get this by passing the protocol
vars "tag" and "specstring" when you ask for the spec), use
that to set up a Spec object, and then feed the Spec the form dictionary (you
get this as well when you use the "tag" protocol).  Then you
can make changes to the dictionary and have the Spec object write the form back
out as plain text with Fmt().

Actually it's probably easier to just look at how --field is implemented
since that's exactly what it does.     :)
https://swarm.workshop.perforce.com/projects/perforce_software-p4/files/2016-1/client/clientuserdbg.cc#145
  -- here's how to use the Spec object
https://swarm.workshop.perforce.com/projects/perforce_software-p4/files/2016-1/client/clientmain.cc#486
  -- here's the protocol vars to set  

The P4 .NET version of the Spec class looks like it's called FormSpec:   
https://www.perforce.com/perforce/doc.current/manuals/p4api.net/p4api.net_reference/html/T_Perforce_P4_FormSpec.htm



--
Please click here to see the post in its original format:
  http://forums.perforce.com/index.php?/topic/5264-how-to-use-field-descriptionblah-command-in-c-api


More information about the perforce-user mailing list