查找最新作者
问题描述:
我想检查作者最后一次提交,如果它将是John,请删除该文件。我得到错误expecting ')', found 'git'
,并不知道什么是错的。查找最新作者
@Grapes(
@Grab(group='org.eclipse.jgit', module='org.eclipse.jgit', version='4.8.0.201706111038-r'))
import groovy.io.FileType
import org.eclipse.jgit.api.*
import org.eclipse.jgit.lib.*
import org.eclipse.jgit.revwalk.*
def changelogPath = "C:\\test" // value from branch
def packID = "test" // value from branch
def badAuthor = 'John'
String folderPath = "$changelogPath"+ "\\" + "$PackID" // Path to file Windows environment, if it will be Unix, change \\ -> //
def authorEqual(String packID, String changelogPath, String badAuthor) {
Git git = Git.open(new File("."))
PersonIdent aAuthort = commit.getAuthorIdent()
try {
RevWalk walk = new RevWalk(git)
RevCommit commit = walk.parseCommit(head.getObjectId());
if(commit.getAuthorIdent().getWhen().equals(aAuthor == BadAuthor)
git.rm().call() <-- HERE
}
}
authorEqual()
答
你错过收盘)
在if
结束:
if (commit.getAuthorIdent().getWhen().equals(aAuthor == BadAuthor))
// This was missing ------------------------------------------^
git.rm().call()
Dzizas,谢谢! :) –