[英]How can i get all Changelists of a branch since a specific Changelist?
I like to use the Perforce Java API to make a list of all changelists since a specific Changelist of a Branch. 我喜欢使用Perforce Java API列出自分支的特定变更列表以来的所有变更列表。 On the command line you can get it with: p4 changes -L BRANCHNAME@CHANGELISTID,#head. 在命令行上,您可以使用以下命令获取它:p4更改-L BRANCHNAME @ CHANGELISTID,#head。 But now i like to use the API. 但是现在我喜欢使用API。
List<IFileSpec> fileSpecs = new ArrayList<>();
FilePath path = new FilePath(PathType.DEPOT, p4Branch + "/...");
FileSpec fileSpec = new FileSpec(path);
fileSpec.setChangelistId(changelist.getId());
printFileSpec(fileSpec);
fileSpecs.add(fileSpec);
try {
changelists = server.getChangelists(100, fileSpecs, null, null, false, true, false, true);
if(changelists.isEmpty()) {
System.out.println("Empty Changelists");
} else {
System.out.println("Changelists has " + changelists.size() + " elements");
}
} catch (Exception e) {
e.printStackTrace();
}
With fileSpec.setChangelistId(changelist.getId()); 使用fileSpec.setChangelistId(changelist.getId()); I only can set that it will give me the Changelists before the Changelist (Which is similar to the command: p4 changes -L BRANCHNAME@CHANGELISTID that's also exact how my fileSpecs looks. 我只能设置为它将在变更列表之前给我变更列表(这与命令类似:p4更改-L BRANCHNAME @ CHANGELISTID,这也与我的fileSpecs外观完全一样。
Is there a possibility to set something in the API to achieve this? 是否可以在API中进行设置以实现这一目标? Or do i have to use some different Methods of the API? 还是我必须使用一些不同的API方法?
Thanks. 谢谢。
尝试通过以下方式构建FileSpecs:
List<IFileSpec> fileSpecs = FileSpecBuilder.makeFileSpecList(p4Branch + "/...@" + changelist.getId() + ",#head");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.