首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用Perforce p4java库查找未解析的文件?

如何使用Perforce p4java库查找未解析的文件?
EN

Stack Overflow用户
提问于 2012-01-03 22:03:16
回答 1查看 1.3K关注 0票数 1

使用来自Perforce (http://kb.perforce.com/article/1086/p4java-api)的p4java库,我试图找出变更列表中哪些文件未解析,需要在提交它们之前解析它们。

代码语言:javascript
复制
IChangelist changelist = getServer().getChangelist(changelistId);
List<IFileSpec> changelistPendingFiles = changelist.getFiles(false);

在这个列表中,我试图找出哪些IFileSpec仍然需要解决。

如下所示:

代码语言:javascript
复制
for (IFileSpec pendingFile : changelistPendingFiles) {
    // How to find out if pendingFile needs to be resolved?

    FileAction action = pendingFile.getAction();
    // The above results in "FileAction.EDIT",
    // but that doesn't tell me anything about the unresolved state

    // The "diffStatus" variable for this pendingFile is "pending"
    // The "howResolved" variable for this pendingFile is null
    // The "opStatus" variable for this pendingFile is VALID
}

感谢您所能提供的一切!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-01-05 00:44:48

综合的方法是运行P4Java版本的fstat命令,并检查文件是否需要解析。下面是一个代码示例(不能保证是防弹的),它在一个简单的测试用例中工作。

代码语言:javascript
复制
List<IExtendedFileSpec> extfiles = server.getExtendedFiles(changelistPendingFiles,
    -1,
    -1,
    -1,
    new FileStatOutputOptions(false, false, false, false, false, true),
    null);

for(IExtendedFileSpec extfile : extfiles) {        
    System.out.println(extfile.isUnresolved());
}

在FileStatOutputOptions中,我请求有关打开的和需要解析的文件的信息。isUnresolved方法应该告诉你你想要什么。

希望这能有所帮助!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8713392

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档