gitk: Establish and use global left-to-right ordering for commits
commit6e8c87070306a757c4d7fd2c55cca3a90fe140c7
authorPaul Mackerras <paulus@samba.org>
Tue, 31 Jul 2007 11:03:06 +0000 (31 21:03 +1000)
committerPaul Mackerras <paulus@samba.org>
Tue, 31 Jul 2007 11:03:06 +0000 (31 21:03 +1000)
tree904e19cb8d378fcbd0248c3f5d5d45d1f481322e
parent3244729aac7515ccda651d40f41cef94517ac089
gitk: Establish and use global left-to-right ordering for commits

This creates an "ordering token" for each commit which establishes
a total ordering for commits and is used to order the commits from
left to right on a row.  The ordering token is assigned when a commit
is first encountered or when it is first listed as a parent of some
other commit, whichever comes first.  The ordering token is a string
of variable length.  Parents that don't already have an ordering
token are assigned one by appending to the child's token; the first
parent gets a "0" on the end, the second "1" and so on.  As an
optimization, the "0" isn't appended if the child only has one parent.

When inserting a new commit into an element of rowidlist, it is
inserted in the position which makes the ordering tokens increase
from left to right.

This also simplifies the layout code by getting rid of the rowoffsets
variable, and terminates lines with an arrow after 5 rows if the line
would be longer than about 110 rows (rather than letting them go on
and terminating them later with an arrow if the graph gets too wide).

The effect of having the total ordering, and terminating the lines
early, is that it will be possible to lay out only a part of the graph
rather than having to do the whole thing top to bottom.

Signed-off-by: Paul Mackerras <paulus@samba.org>
gitk