Jump to content


Determine max changelistId in Perforce checkout using p4java client

p4java

  • Please log in to reply
3 replies to this topic

#1 gbo

gbo

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 28 May 2013 - 05:50 PM

Is there a way to get max changeListId/revisionId of the my local Perforce view using the p4java API? I need the revision ID to determine if my local repo is in synch with the server.

Details such as this sample from 'p4 cstat' would be perfect:

p4 cstat
... change 1
... status have

......

... change 17
... status partial

... change 18
... status need

p4java p4java version 2012.3

Thanks in advance!

#2 P4Matt

P4Matt

    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 28 May 2013 - 06:46 PM

Check out the execStreamCmd() method. It will allow you to run pretty much any Perforce command and get the results back in a dictionary. It should work well for 'p4 cstat'.

#3 gbo

gbo

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 29 May 2013 - 12:14 PM

Thank you for your response!!

I've done some tests. Unfortunately it doesn't seem to support this command. I've run a test like this:

     server.execStreamCmd("cstat", null);
which throws:

"com.perforce.p4java.exception.RequestException: command name 'cstat' unimplemented or unrecognized by p4java"

I assume my syntax is correct (and client sin't outdated) since I can't find the command in the CmdSpc doc either:

http://www.perforce....er/CmdSpec.html

My current workaround is using "IClient.synch()" with noUpdate=true. It seem to work OK, although I'd prefer to a single API call to check rather than having custom logic for this.

Any chance you think I might me missing something else?
Thanks again!


#4 P4Matt

P4Matt

    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 29 May 2013 - 03:37 PM

Bah! P4Java has a whitelist of commands it allows. I would have thought cstat would be on the list, but apparently not. I'm in the process of preparing P4Java's source code for an open source release, so soon we will be able to nip these problems in the bud. =)

I'm glad you have a workaround for the time being. I'll post here when I release P4Java in source form; it'll be a few weeks.

Update: cstat is now an accepted command. P4Java is still scheduled to be open sourced but I think we're looking at a June 2014 timeline.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users