Skip to content

Commit

Permalink
Upgrade to Scala 2.13
Browse files Browse the repository at this point in the history
  • Loading branch information
rtyley committed Jun 17, 2019
1 parent 13d6119 commit da43e0f
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import ReleaseTransformations._

lazy val baseSettings = Seq(
scalaVersion := "2.12.8",
crossScalaVersions := Seq(scalaVersion.value, "2.11.12"),
scalaVersion := "2.13.0",
crossScalaVersions := Seq(scalaVersion.value, "2.12.8"),
organization := "com.madgag.scala-git",
scmInfo := Some(ScmInfo(
url("https://github.com/rtyley/scala-git"),
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ object Dependencies {
val eclipseJgit = "org.eclipse.jgit" % "org.eclipse.jgit" % "4.0.1.201506240215-r"
val jgit = eclipseJgit

val scalatest = "org.scalatest" %% "scalatest" % "3.0.4"
val scalatest = "org.scalatest" %% "scalatest" % "3.0.8"

val madgagCompress = "com.madgag" % "util-compress" % "1.33"

Expand Down
6 changes: 3 additions & 3 deletions scala-git/src/main/scala/com/madgag/diff/MapDiff.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ case class MapDiff[K, V](beforeAndAfter: Map[BeforeAndAfter, Map[K,V]]) {
lazy val commonElements: Set[K] = beforeAndAfter.values.map(_.keySet).reduce(_ intersect _)

lazy val only: Map[BeforeAndAfter, Map[K,V]] =
beforeAndAfter.mapValues(_.filterKeys(!commonElements(_)))
beforeAndAfter.view.mapValues(_.view.filterKeys(!commonElements(_)).toMap).toMap

lazy val (unchanged, changed) =
commonElements.partition(k => beforeAndAfter(Before)(k) == beforeAndAfter(After)(k))

lazy val unchangedMap: Map[K,V] = beforeAndAfter(Before).filterKeys(unchanged)
lazy val unchangedMap: Map[K,V] = beforeAndAfter(Before).view.filterKeys(unchanged).toMap

lazy val changedMap: Map[K,Map[BeforeAndAfter, V]] =
changed.map(k => k -> beforeAndAfter.mapValues(_(k))).toMap
changed.map(k => k -> beforeAndAfter.view.mapValues(_(k)).toMap).toMap

}
8 changes: 4 additions & 4 deletions scala-git/src/main/scala/com/madgag/git/model/Tree.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ object Tree {

val Empty = Tree(Map.empty[FileName, (FileMode, ObjectId)])

def apply(entries: Traversable[Tree.Entry]): Tree = Tree(entries.map {
def apply(entries: Iterable[Tree.Entry]): Tree = Tree(entries.map {
entry => entry.name -> ((entry.fileMode, entry.objectId))
}.toMap)

Expand All @@ -42,7 +42,7 @@ object Tree {
entries += Entry(treeParser)
treeParser.next()
}
entries
entries.toSeq
}

case class Entry(name: FileName, fileMode: FileMode, objectId: ObjectId) extends Ordered[Entry] {
Expand Down Expand Up @@ -91,7 +91,7 @@ case class Tree(entryMap: Map[FileName, (FileMode, ObjectId)]) {

protected def repr = this

lazy val entries = entryMap.map {
lazy val entries: Iterable[Tree.Entry] = entryMap.map {
case (name, (fileMode, objectId)) => Tree.Entry(name, fileMode, objectId)
}

Expand Down Expand Up @@ -142,7 +142,7 @@ object TreeBlobs {

case class TreeBlobs(entryMap: Map[FileName, (BlobFileMode, ObjectId)]) extends Tree.EntryGrouping {

lazy val entries = entryMap.map {
lazy val entries: Iterable[TreeBlobEntry] = entryMap.map {
case (name, (blobFileMode, objectId)) => TreeBlobEntry(name, blobFileMode, objectId)
}

Expand Down
2 changes: 1 addition & 1 deletion scala-git/src/main/scala/com/madgag/git/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ package object git {
}

def diff(trees: RevTree*)(implicit reader: ObjectReader): Seq[DiffEntry] =
DiffEntry.scan(walk(trees: _*)(TreeFilter.ANY_DIFF)).asScala
DiffEntry.scan(walk(trees: _*)(TreeFilter.ANY_DIFF)).asScala.toSeq

def allBlobsUnder(tree: RevTree)(implicit reader: ObjectReader): Set[ObjectId] =
tree.walk().map(_.getObjectId(0)).toSet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package com.madgag.git

import org.scalatest.{FlatSpec, Matchers}
import com.madgag.git.test._

import scala.language.postfixOps

class ReachableBlobSpec extends FlatSpec with Matchers {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class RichTreeWalkSpec extends FlatSpec with Matchers {

fileNameList should have size 6

fileNameList.groupBy(identity).mapValues(_.size) should contain ("zero" -> 2)
fileNameList.groupBy(identity).view.mapValues(_.size).toMap should contain ("zero" -> 2)
}

it should "implement withFilter" in {
Expand Down

0 comments on commit da43e0f

Please sign in to comment.