我在网上看到了使用Perforce的p4java api将客户端工作区与最新文件同步的示例。例:
public List<IFileSpec> sync(List<IFileSpec> fileSpecs,
boolean forceUpdate,
boolean noUpdate,
boolean clientBypass,
boolean serverBypass)但是如何指定它来同步到特定的标签呢?这相当于命令行中的内容:
p4 sync @labelname也许是通过使用SyncOptions的替代方法吗?
public List<IFileSpec> sync(List<IFileSpec> fileSpecs,
SyncOptions syncOpts)我看了一下SyncOptions,但是没有看到在那里指定标签的任何方法。
发布于 2015-12-06 07:00:03
在上面给出查看fileSpecs参数的建议之后,我发现这个方法适用于我:
List<IFileSpec> fileSpecsSet =
FileSpecBuilder.makeFileSpecList("//path/to/project/...@labelname");
client.sync(fileSpecsSet, true, false, false, false);发布于 2015-12-04 08:40:11
FileSpec是IFileSpec的一个实现,它有一个label字段:
protected String label以及以下方法:
void setLabel(String label)
Set the label associated with this file spec.摘自以下链接:
https://stackoverflow.com/questions/34078214
复制相似问题