Closed marnen closed 6 years ago
Hi Marnen,
It's been a while for this question and I'm not sure if you have figured this out eventually. I reached this project when I was looking for a simple tool to visualise my Git project. I'll try to answer your question in case someone else come to this as well.
The graph data is composed of an array of nodes. As documented in the _commitsgraphy.py, each node is formatted as follows: [ sha, //commit hash [offest, branch], // Dot - x-axis offset position and branch it belongs to [ [from, to, branch], // Route 1 - The x-axis position from and to, and its corresponding branch [from, to, branch], // Route 2 [from, to, branch], ] // Route array (branches) ]
Take a vertical graph as example. Let's call the rightest position as x-axis position 0. It loops through the node array and draws from the top, one level by one level. For each iteration,
In fact, to draw the branches properly, each node will need to draw other branches even though it does not belong to them. (Otherwise, you won't see the long line for a branch)
Let's use my git project's as example. The data is: [ commit1, [0,0], [[0,0,0]], commit2, [0,0], [[0,0,0], [0,1,1]], commit3, [1,1], [[0,0,0], [1,1,1], [1,2,2]], commit4, [0,0], [[0,0,0], [1,1,1], [2,2,2]], ... ]
//Node 1 Start
//Node 2 Start
//Node 3 Start
I recently had occasion to try to make this into a Chrome extension (so I wouldn't have been able to use the Python script). Unfortunately, the input format is unclear and seems to be undocumented, so I wasn't able to figure it out. This tool draws beautiful graphs, but it's hard to work with if the input format is undocumented.