Created
August 31, 2009 01:59
-
-
Save geelen/178250 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
exec scala -cp /home/glen/src/gitwatch/lib/jgit.jar $0 $@ | |
!# | |
import java.io.File | |
import org.spearce.jgit.lib.{Commit => GitCommit, Repository} | |
val repo = new Repository(new File(args(0))) | |
val head = repo.mapCommit("HEAD") | |
def history(c: GitCommit): List[GitCommit] = { | |
c :: c.getParentIds.take(1).map(repo.mapCommit(_)).flatMap(history(_)).toList | |
} | |
println(history(head).take(args(1).toInt).map(_.getMessage).mkString("")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment