自特定变更列表以来,如何获取分支的所有变更列表? [英] How can i get all Changelists of a branch since a specific Changelist?

查看:51
本文介绍了自特定变更列表以来,如何获取分支的所有变更列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢使用 Perforce Java API 来制作自分支的特定变更列表以来的所有变更列表.在命令行上,您可以使用以下命令获取它:p4 changes -L BRANCHNAME@CHANGELISTID,#head.但现在我喜欢使用 API.

I like to use the Perforce Java API to make a list of all changelists since a specific Changelist of a Branch. On the command line you can get it with: p4 changes -L BRANCHNAME@CHANGELISTID,#head. But now i like to use the 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();
    }

随着fileSpec.setChangelistId(changelist.getId());我只能设置它会在更改列表之前为我提供更改列表(类似于以下命令:p4 changes -L BRANCHNAME@CHANGELISTID 这也正是我的 fileSpecs 的外观.

With 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.

是否有可能在 API 中设置一些东西来实现这一点?还是我必须使用 API 的一些不同方法?

Is there a possibility to set something in the API to achieve this? Or do i have to use some different Methods of the API?

谢谢.

推荐答案

尝试以这种方式构建您的 FileSpec:

Try building your FileSpecs this way:

List<IFileSpec> fileSpecs = FileSpecBuilder.makeFileSpecList(p4Branch + "/...@" + changelist.getId() + ",#head");

这篇关于自特定变更列表以来,如何获取分支的所有变更列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆