Skip to content

Latest commit

 

History

History
54 lines (44 loc) · 2.11 KB

File metadata and controls

54 lines (44 loc) · 2.11 KB

代码对比


用途

增量修改代码diff计算。

参数说明

参数 类型 必须 说明
execType ExecType 执行类型
projectRootPath String 项目根目录路径
currentBranch String 当前分支
compareBranch String 对比分支
currentCommit String 当前commit版本
compareCommit String 对比commit版本
currentTag String 当前tag
compareTag String 对比tag
gitParam GitParam git参数
excludes List 需要排除的包名
excludesMethod List 需要排除的方法名
excludeSubPkg List 需要排除的子工程
relationSubPkg List 关联的子工程
needUpdate Boolean 工程代码是否需要更新

使用示例

GitParam gitParam = new GitParam();
gitParam.setGitAccessType(ACCESS_TOKEN);
gitParam.setGitAccessToken(gitAccessToken);
gitParam.setGitRepoDir(PROJECT_PATH);
CodeOperate operate = new CodeOperate(gitParam);

try {
  operate.cloneCode(cloneUrl,branchName);
  operate.checkoutAndPull(cloneUrl, branchName);
  List<String> result = operate.getBranchList(ListBranchCommand.ListMode.REMOTE);
  Iterable<RevCommit> commitsresult = operate.getCommitList(branchName, 10);
  Ref ref = operate.getCurrentRef();
  operate.reset(ref.getName());
} catch (Exception e) {
  e.printStackTrace();
}

供参考单测:

CodeOperateTest