2017-08-29 5 views
0

私は作者の最後のコミットをチェックしたい、それがジョンであればそのファイルを削除する。エラー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

あなたはifの終わりに決算)を逃している:

if (commit.getAuthorIdent().getWhen().equals(aAuthor == BadAuthor)) 
    // This was missing ------------------------------------------^ 
    git.rm().call() 
+0

Dzizasを、ありがとう! :) –

関連する問題