Search code examples
perforcep4api

p4 tickets: output says I need to upgrade?


I'm using p4api 2018.1. Issuing a p4 tickets from the Run method, the output message from stdout says: "Must upgrade to 2004.2 p4 to access tickets."

This doesn't sound like an upgrade to me.

I tried it with this code.

int errNo;
ClientUser ui;
ClientApi client;
Error err;

client.DefinePort(myport, &err);
client.DefineClient(myclient, &err);

client.Init(&err);

client.Run("tickets", &ui);
errNo = client.Final(&err);

myport and myclient are string values that have valid port and client values. They've been successfully tested on other commands as well.

What I was expecting was a list of my current tickets to be displayed from stdout.


Solution

  • p4 tickets isn't a server command that you can access via the API, it's implemented directly in the P4 CLI (bypassing the usual client.Run() call). If you actually send the tickets command to the server, the server tells you to upgrade your client because it assumes that a newer client would know that tickets isn't a real command.

    If you want to implement functionality similar to p4 tickets in your app, take a look at the clientTickets function in clientmain.cc:

    https://workshop.perforce.com/files/guest/perforce_software/p4/2018-2/client/clientmain.cc#936