Fixed previous commits of uncommited changes not showing in the same column
This commit is contained in:
parent
7c2029d602
commit
4a6542abcd
@ -63,7 +63,7 @@ class GraphCommitList : RevCommitList<GraphNode>() {
|
|||||||
override fun enter(index: Int, currCommit: GraphNode) {
|
override fun enter(index: Int, currCommit: GraphNode) {
|
||||||
if(currCommit.id == parentId) {
|
if(currCommit.id == parentId) {
|
||||||
graphCommit.graphParent = currCommit
|
graphCommit.graphParent = currCommit
|
||||||
currCommit.addChild(graphCommit)
|
currCommit.addChild(graphCommit, addFirst = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
setupChildren(currCommit)
|
setupChildren(currCommit)
|
||||||
|
@ -31,22 +31,34 @@ open class GraphNode(id: AnyObjectId?) : RevCommit(id), IGraphNode {
|
|||||||
mergingLanes = addLane(graphLane, mergingLanes)
|
mergingLanes = addLane(graphLane, mergingLanes)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addChild(c: GraphNode) {
|
fun addChild(c: GraphNode, addFirst: Boolean = false) {
|
||||||
when (val childrenCount = children.count()) {
|
when (val childrenCount = children.count()) {
|
||||||
0 -> children = arrayOf(c)
|
0 -> children = arrayOf(c)
|
||||||
1 -> if (!c.id.equals(children[0].id)) children = arrayOf(children[0], c)
|
1 -> {
|
||||||
|
if (!c.id.equals(children[0].id)) {
|
||||||
|
children = if (addFirst) {
|
||||||
|
arrayOf(c, children[0])
|
||||||
|
} else
|
||||||
|
arrayOf(children[0], c)
|
||||||
|
}
|
||||||
|
}
|
||||||
else -> {
|
else -> {
|
||||||
for (pc in children)
|
for (pc in children)
|
||||||
if (c.id.equals(pc.id))
|
if (c.id.equals(pc.id))
|
||||||
return
|
return
|
||||||
|
|
||||||
val n: Array<GraphNode> = children.copyOf(childrenCount + 1).run {
|
val resultArray = if (addFirst) {
|
||||||
|
val childList = mutableListOf(c)
|
||||||
|
childList.addAll(children)
|
||||||
|
childList.toTypedArray()
|
||||||
|
} else {
|
||||||
|
children.copyOf(childrenCount + 1).run {
|
||||||
this[childrenCount] = c
|
this[childrenCount] = c
|
||||||
requireNoNulls()
|
requireNoNulls()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
n[childrenCount] = c
|
children = resultArray
|
||||||
children = n
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user