Skip to content

Commit 42df710

Browse files
committed
Merge pull request #15 from adriaanm/master
merge improvements to git parsing from 2.9.x to master
2 parents bb434b8 + 3b587bd commit 42df710

File tree

6 files changed

+46
-34
lines changed

6 files changed

+46
-34
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Scala Release Notes Creator
22

3-
This project generates the HTML release notes for Scala. It's goal is to be minimal and sufficient. Not an ideal example of scala code,
3+
This project generates the HTML release notes for Scala. Its goal is to be minimal and sufficient. Not an ideal example of Scala code,
44
but perhaps shows off a few standard library APIs.
55

66

@@ -12,7 +12,7 @@ For now, it's still mostly manual. What you need to do:
1212
2. Update the highlights notes in `hand-written.md`.
1313
3. run `sbt console`, and then the following:
1414

15-
scala> MakeReleaseNotes(new java.io.File("/path/to/scala/checkout"), "v2.9.2", "v2.10.0-RC3")
15+
scala> MakeReleaseNotes(new java.io.File("~/git/scala"), "v2.9.2", "v2.9.3")
1616

1717
where the two strings are the tags to compare.
1818

build.sbt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ name := "scala-release-note-generator"
33
scalaVersion := "2.10.0-RC3"
44

55
libraryDependencies += "org.pegdown" % "pegdown" % "1.2.0"
6+
7+
libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.1"

hand-written.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1-
We are pleased to announce the first release candidate of Scala 2.10.1!
1+
We are pleased to announce the second release candidate of Scala 2.10.1!
22

3-
The Scala team and contributors [fixed 177 issues since 2.10.0](https://issues.scala-lang.org/secure/IssueNavigator.jspa?reset=true&jqlQuery=project+%3D+SI+AND+fixVersion+%3D+%22Scala+2.10.1-RC1%22+AND+status+%3D+closed+ORDER+BY+priority+DESC)!
4-
In total, [242 pull requests](https://github.com/scala/scala/issues?milestone=5&page=1&state=closed) were opened on [GitHub](https://github.com/scala/scala), of which [225 were merged](https://gist.github.com/adriaanm/4760366) after having been [tested](https://github.com/typesafehub/ghpullrequest-validator) and reviewed.
3+
The Scala team and contributors [fixed 184 issues since 2.10.0](https://issues.scala-lang.org/secure/IssueNavigator.jspa?reset=true&jqlQuery=project+%3D+SI+AND+%28fixVersion+%3D+%22Scala+2.10.1-RC1%22+OR+fixVersion+%3D+%22Scala+2.10.1-RC2%22%29+AND+status+%3D+closed+ORDER+BY+priority+DESC)!
4+
In total, [242 pull requests](https://github.com/scala/scala/issues?milestone=5&page=1&state=closed) (+ [7 for RC2](https://github.com/scala/scala/issues?milestone=13&page=1&state=closed)) were opened on [GitHub](https://github.com/scala/scala), of which [225 were merged](https://gist.github.com/adriaanm/4760366) (+ 6 for RC2) after having been [tested](https://github.com/typesafehub/ghpullrequest-validator) and reviewed.
55

6-
Please give 2.10.1-RC1 a spin! It's designed to be a drop-in replacement for 2.10.0.
6+
Please give 2.10.1-RC2 a spin! It's designed to be a drop-in replacement for 2.10.0.
77
We'd love to hear about any regressions since 2.10.0 and will try to fix them before releasing the final version.
88

9+
There will be an RC3 one week after this release, which will become the final unless new blocker issues are discovered within a week after its release.
10+
11+
<!--break-->
12+
913
### Known Issues
10-
Before reporting a bug, please have a look at these known issues scheduled [for 2.10.1-RC2](https://issues.scala-lang.org/secure/IssueNavigator.jspa?reset=true&jqlQuery=project+%3D+SI+AND+fixVersion+%3D+%22Scala+2.10.1-RC2%22+AND+resolution+%3D+Unresolved++ORDER+BY+priority+DESC%2C+key+DESC).
14+
Before reporting a bug, please have a look at these known issues scheduled [for 2.10.1-RC3](https://issues.scala-lang.org/secure/IssueNavigator.jspa?reset=true&jqlQuery=project+%3D+SI+AND+fixVersion+%3D+%22Scala+2.10.1-RC3%22+AND+resolution+%3D+Unresolved++ORDER+BY+priority+DESC%2C+key+DESC).
1115

1216
### Scala IDE for Eclipse
13-
The Scala IDE with Scala 2.10.1-RC1 built right in is available through one of the following update-sites:
17+
The Scala IDE with Scala 2.10.1-RC2 built right in is available through one of the following update-sites:
1418

15-
* [for Eclipse 3.7 (Indigo)](http://download.scala-ide.org/sdk/next/e37/scala210/dev/site/)
16-
* [for Eclipse 3.8/4.2 (Juno)](http://download.scala-ide.org/sdk/next/e38/scala210/dev/site/) (Support for this version is experimental.)
19+
* [for Eclipse 3.7 (Indigo)](http://download.scala-ide.org/sdk/e37/scala210/dev/site/)
20+
* [for Eclipse 3.8/4.2 (Juno)](http://download.scala-ide.org/sdk/e38/scala210/dev/site/) (Support for this version is experimental.)
1721

1822
Have a look at the [getting started guide](http://scala-ide.org/docs/user/gettingstarted.html) for more info.
1923

release-notes.html

Lines changed: 11 additions & 11 deletions
Large diffs are not rendered by default.

src/main/scala/GitInfo.scala

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,17 @@ case class Commit(sha: String, author: String, header: String, body: String) {
66

77
/** Gobal functions for dealing with git. */
88
object GitHelper {
9-
val gitFormat = "--format=format:*-*%h``%aN``%s``%b"
10-
def processGitCommits(input: String): IndexedSeq[Commit] =
11-
input.lines.map(_.split("``", 4)).collect {
12-
case Array(sha, author, hdr, msg) => Commit(sha, author, hdr, msg)
9+
def processGitCommits(gitDir: java.io.File, previousTag: String, currentTag: String): IndexedSeq[Commit] = {
10+
import sys.process._
11+
val gitFormat = "%h %s" // sha and subject
12+
val log = Process(Seq("git", "--no-pager", "log", s"${previousTag}..${currentTag}","--format=format:"+gitFormat,"--no-merges", "--topo-order"), gitDir).lines
13+
14+
log.par.map(_.split(" ", 2)).collect {
15+
case Array(sha, title) =>
16+
val (author :: body) = Process(Seq("git", "--no-pager", "show", sha ,"--format=format:%aN%n%b","--quiet"), gitDir).lines.toList
17+
Commit(sha, author, title, body.mkString("\n"))
1318
}.toVector
19+
}
1420

1521
def hasFixins(msg: String): Boolean = (
1622
(msg contains "SI-") /*&& ((msg.toLowerCase contains "fix") || (msg.toLowerCase contains "close"))*/
@@ -28,14 +34,12 @@ object GitHelper {
2834
issues map (si => """<a href="https://issues.scala-lang.org/browse/%s">%s</a>""" format (si, si)) mkString ", "
2935
}
3036

37+
def htmlEncode(s: String) = org.apache.commons.lang3.StringEscapeUtils.escapeHtml4(s)
3138
}
3239

3340
class GitInfo(gitDir: java.io.File, val previousTag: String, val currentTag: String) {
34-
import sys.process._
3541
import GitHelper._
36-
37-
def runGit = Process(Seq("git", "log", s"${previousTag}..${currentTag}","--format=format:%h``%aN``%s``%b","--no-merges"), gitDir)
38-
val commits = processGitCommits(runGit.!!)
42+
val commits = processGitCommits(gitDir, previousTag, currentTag)
3943

4044
val authors: Seq[(String, Int)] = {
4145
val grouped: Vector[(String,Int)] = (commits groupBy (_.author)).map { case (a,c) => a -> c.length }{collection.breakOut}
@@ -63,7 +67,7 @@ class GitInfo(gitDir: java.io.File, val previousTag: String, val currentTag: Str
6367
| <thead><tr><th>#</th><th align="left">Author</th></tr></thead>
6468
|<tbody>""".stripMargin
6569
for((author, count) <- authors)
66-
sb append s"""<tr><td align="right">${count} &nbsp;</td><td>${author}</td></tr>"""
70+
sb append s"""<tr><td align="right">${count} &nbsp;</td><td>${htmlEncode(author)}</td></tr>"""
6771
sb append """</tbody></table>"""
6872
sb.toString
6973
}
@@ -76,7 +80,7 @@ class GitInfo(gitDir: java.io.File, val previousTag: String, val currentTag: Str
7680
<thead><tr><th>sha</th><th align="left">Title</th></tr></thead>
7781
<tbody>"""
7882
for(commit <- commits)
79-
sb append s"""<tr><td align="right">${commitShaLink(commit.sha)}&nbsp;</td><td>${commit.header}</td></tr>"""
83+
sb append s"""<tr><td align="right">${commitShaLink(commit.sha)}&nbsp;</td><td>${htmlEncode(commit.header)}</td></tr>"""
8084
sb append """</tbody>
8185
</table>"""
8286
sb.toString
@@ -90,7 +94,7 @@ class GitInfo(gitDir: java.io.File, val previousTag: String, val currentTag: Str
9094
<thead><tr><th>Issue(s)</th><th>Commit</th><th>Message</th></tr></thead>
9195
<tbody>""")
9296
for(commit <- fixCommits)
93-
sb append s"""<tr><td>${fixLinks(commit)}&nbsp;</td><td>${commitShaLink(commit.sha)}&nbsp;</td><td>${commit.header}</td></tr>"""
97+
sb append s"""<tr><td>${fixLinks(commit)}&nbsp;</td><td>${commitShaLink(commit.sha)}&nbsp;</td><td>${htmlEncode(commit.header)}</td></tr>"""
9498
sb append """</tbody>
9599
</table>"""
96100
sb append blankLine()

src/main/scala/MakeReleaseNotes.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,18 @@ object MakeReleaseNotes {
3434

3535
def makeReleaseNotes(scalaDir: java.io.File, previousTag: String, currentTag: String): String = {
3636
val info = new GitInfo(scalaDir, previousTag, currentTag)
37-
val communityProjects = CommunityProjects.loadHtmlFromFile()
37+
// val communityProjects = CommunityProjects.loadHtmlFromFile()
3838
import info.{currentTag => _, _}
39+
// <h3> Known issues </h3>
40+
// ${JiraIssues.makeOpenIssuesString}
41+
3942
s"""<html>
4043
<head>
4144
<title>${currentTag} - Release notes</title>
4245
</head>
4346
<body>
4447
<h3>Scala ${currentTag drop 1} is now available!</h3>
4548
${parseHandWrittenNotes()}
46-
${communityProjects}
4749
<br/><br/>
4850
${renderCommitterList}
4951
${renderFixedIssues}

0 commit comments

Comments
 (0)