{"thread":{"id":"3448","subject":"gitview: Display the lines joining commit nodes clearly.","startedAt":"2006-02-23T19:29:42Z","lastAt":"2006-02-23T19:29:42Z","messageCount":1,"participants":["Aneesh Kumar K.V"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"16627","messageId":"43FE0D26.2080304@gmail.com","threadId":"3448","inReplyTo":null,"subject":"gitview: Display the lines joining commit nodes clearly.","fromName":"Aneesh Kumar K.V","fromEmail":"aneesh.kumar@gmail.com","sentAt":"2006-02-23T19:29:42Z","receivedAt":"2006-02-23T19:29:42Z","isPatch":false,"sender":{"key":"aneesh.kumar@gmail.com","avatar":"https://gravatar.com/avatar/0621fc0b2f14ead1e9024382f16053a808c148596da30c1b92572fa075621f68?d=mp&s=160"},"body":"\n\n\nSince i wanted to limit the graph box size i was resetting\nthe window after an index of 5. This result in line joining\ncommit nodes to pass over nodes which are not related. The\nchanges fixes the same\n\nSigned-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>\n\n---\n\n contrib/gitview/gitview |   48 ++++++++++++++++++++++++++++++++++-------------\n 1 files changed, 35 insertions(+), 13 deletions(-)\n\n3fcd411c65b2c6f84052d69ca05766e45a34682e\ndiff --git a/contrib/gitview/gitview b/contrib/gitview/gitview\nindex 4b52eb7..b04df74 100755\n--- a/contrib/gitview/gitview\n+++ b/contrib/gitview/gitview\n@@ -823,6 +823,7 @@ class GitView:\n \t\tself.colours = {}\n \t\tself.nodepos = {}\n \t\tself.incomplete_line = {}\n+\t\tself.commits = []\n \n \t\tindex = 0\n \t\tlast_colour = 0\n@@ -840,12 +841,7 @@ class GitView:\n \n \t\t\tcommit = Commit(commit_lines)\n \t\t\tif (commit != None ):\n-\t\t\t\t(out_line, last_colour, last_nodepos) = self.draw_graph(commit,\n-\t\t\t\t\t\t\t\t\t\tindex, out_line,\n-\t\t\t\t\t\t\t\t\t\tlast_colour,\n-\t\t\t\t\t\t\t\t\t\tlast_nodepos)\n-\t\t\t\tself.index[commit.commit_sha1] = index\n-\t\t\t\tindex += 1\n+\t\t\t\tself.commits.append(commit)\n \n \t\t\t# Skip the '\\0\n \t\t\tcommit_lines = []\n@@ -854,6 +850,14 @@ class GitView:\n \n \t\tfp.close()\n \n+\t\tfor commit in self.commits:\n+\t\t\t(out_line, last_colour, last_nodepos) = self.draw_graph(commit,\n+\t\t\t\t\t\t\t\t\t\tindex, out_line,\n+\t\t\t\t\t\t\t\t\t\tlast_colour,\n+\t\t\t\t\t\t\t\t\t\tlast_nodepos)\n+\t\t\tself.index[commit.commit_sha1] = index\n+\t\t\tindex += 1\n+\n \t\tself.treeview.set_model(self.model)\n \t\tself.treeview.show()\n \n@@ -869,13 +873,6 @@ class GitView:\n \t\t\tlast_nodepos = 0\n \n \t\t# Add the incomplete lines of the last cell in this\n-\t\tfor sha1 in self.incomplete_line.keys():\n-\t\t\tif ( sha1 != commit.commit_sha1):\n-\t\t\t\tfor pos in self.incomplete_line[sha1]:\n-\t\t\t\t\tin_line.append((pos, pos, self.colours[sha1]))\n-\t\t\telse:\n-\t\t\t\tdel self.incomplete_line[sha1]\n-\n \t\ttry:\n \t\t\tcolour = self.colours[commit.commit_sha1]\n \t\texcept KeyError:\n@@ -897,6 +894,14 @@ class GitView:\n \t\t\tself.colours[commit.parent_sha1[0]] = colour\n \t\t\tself.nodepos[commit.parent_sha1[0]] = node_pos\n \n+\t\tfor sha1 in self.incomplete_line.keys():\n+\t\t\tif ( sha1 != commit.commit_sha1):\n+\t\t\t\tself.draw_incomplete_line(sha1, node_pos,\n+\t\t\t\t\t\tout_line, in_line, index)\n+\t\t\telse:\n+\t\t\t\tdel self.incomplete_line[sha1]\n+\n+\n \t\tin_line.append((node_pos, self.nodepos[commit.parent_sha1[0]],\n \t\t\t\t\tself.colours[commit.parent_sha1[0]]))\n \n@@ -936,6 +941,23 @@ class GitView:\n \t\texcept KeyError:\n \t\t\tself.incomplete_line[sha1] = [self.nodepos[sha1]]\n \n+\tdef draw_incomplete_line(self, sha1, node_pos, out_line, in_line, index):\n+\t\tfor idx, pos in enumerate(self.incomplete_line[sha1]):\n+\t\t\tif(pos == node_pos):\n+\t\t\t\tout_line.append((pos,\n+\t\t\t\t\tpos+0.5, self.colours[sha1]))\n+\t\t\t\tself.incomplete_line[sha1][idx] = pos = pos+0.5\n+\t\t\ttry:\n+\t\t\t\tnext_commit = self.commits[index+1]\n+\t\t\t\tif (next_commit.commit_sha1 == sha1 and pos != int(pos)):\n+\t\t\t\t# join the line back to the node point \n+\t\t\t\t# This need to be done only if we modified it\n+\t\t\t\t\tin_line.append((pos, pos-0.5, self.colours[sha1]))\n+\t\t\t\t\tcontinue;\n+\t\t\texcept IndexError:\n+\t\t\t\tpass\n+\t\t\tin_line.append((pos, pos, self.colours[sha1]))\n+\n \n \tdef _go_clicked_cb(self, widget, revid):\n \t\t\"\"\"Callback for when the go button for a parent is clicked.\"\"\"\n-- \n1.2.3.g2cf3-dirty\n\n"}]}