查找作者的最后一次提交

时间:2017-08-29 07:46:42

标签: git groovy jgit

我想检查作者最后一次提交,如果是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()

1 个答案:

答案 0 :(得分:1)

您错过了collectionView末尾的结束)

if