I've seen examples online of using Perforce's p4java api to sync a client workspace with the latest files. Eg:
public List<IFileSpec> sync(List<IFileSpec> fileSpecs,
boolean forceUpdate,
boolean noUpdate,
boolean clientBypass,
boolean serverBypass)
But how do I specify it to sync to a specific label? Eg, the equivalent of this at the command-line:
p4 sync @labelname
Is it perhaps via the alternate method that uses SyncOptions?
public List<IFileSpec> sync(List<IFileSpec> fileSpecs,
SyncOptions syncOpts)
I had a look at SyncOptions, but didn't see any way to specify a label in there.
After advice above to look into the fileSpecs parameter, I discovered that this method worked for me: