{"thread":{"id":"8582","subject":"[PATCH 1/2] gitview: Fix the blame interface.","startedAt":"2007-06-13T08:46:15Z","lastAt":"2007-06-13T08:46:16Z","messageCount":2,"participants":["Aneesh Kumar K.V"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"44904","messageId":"1181724376650-git-send-email-aneesh.kumar@gmail.com","threadId":"8582","inReplyTo":null,"subject":"[PATCH 1/2] gitview: Fix the blame interface.","fromName":"Aneesh Kumar K.V","fromEmail":"aneesh.kumar@gmail.com","sentAt":"2007-06-13T08:46:15Z","receivedAt":"2007-06-13T08:46:15Z","isPatch":true,"sender":{"key":"aneesh.kumar@gmail.com","avatar":"https://gravatar.com/avatar/0621fc0b2f14ead1e9024382f16053a808c148596da30c1b92572fa075621f68?d=mp&s=160"},"body":"The async reading from the pipe was skipping some of the\ninput lines. Fix the same by making sure that we add the\npartial content of the previous read to the newly read\ndata.\n\nSigned-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>\n---\n contrib/gitview/gitview |   19 ++++++++++++++++++-\n 1 files changed, 18 insertions(+), 1 deletions(-)\n\ndiff --git a/contrib/gitview/gitview b/contrib/gitview/gitview\nindex 098cb01..93ecfc1 100755\n--- a/contrib/gitview/gitview\n+++ b/contrib/gitview/gitview\n@@ -352,6 +352,7 @@ class AnnotateWindow(object):\n \t\tself.window = gtk.Window(gtk.WINDOW_TOPLEVEL)\n \t\tself.window.set_border_width(0)\n \t\tself.window.set_title(\"Git repository browser annotation window\")\n+\t\tself.prev_read = \"\"\n \n \t\t# Use two thirds of the screen by default\n \t\tscreen = self.window.get_screen()\n@@ -401,7 +402,10 @@ class AnnotateWindow(object):\n \tdef data_ready(self, source, condition):\n \t\twhile (1):\n \t\t\ttry :\n-\t\t\t\tbuffer = source.read(8192)\n+\t\t\t\t# A simple readline doesn't work\n+\t\t\t\t# a readline bug ??\n+\t\t\t\tbuffer = source.read(100)\n+\n \t\t\texcept:\n \t\t\t\t# resource temporary not available\n \t\t\t\treturn True\n@@ -411,6 +415,19 @@ class AnnotateWindow(object):\n \t\t\t\tsource.close()\n \t\t\t\treturn False\n \n+\t\t\tif (self.prev_read != \"\"):\n+\t\t\t\tbuffer = self.prev_read + buffer\n+\t\t\t\tself.prev_read = \"\"\n+\n+\t\t\tif (buffer[len(buffer) -1] != '\\n'):\n+\t\t\t\ttry:\n+\t\t\t\t\tnewline_index = buffer.rindex(\"\\n\")\n+\t\t\t\texcept ValueError:\n+\t\t\t\t\tnewline_index = 0\n+\n+\t\t\t\tself.prev_read = buffer[newline_index:(len(buffer))]\n+\t\t\t\tbuffer = buffer[0:newline_index]\n+\n \t\t\tfor buff in buffer.split(\"\\n\"):\n \t\t\t\tannotate_line = re.compile('^([0-9a-f]{40}) (.+) (.+) (.+)$')\n \t\t\t\tm = annotate_line.match(buff)\n-- \n1.5.2.1.255.gca6c0-dirty\n"},{"id":"44905","messageId":"11817244541467-git-send-email-aneesh.kumar@gmail.com","threadId":"8582","inReplyTo":"1181724376650-git-send-email-aneesh.kumar@gmail.com","subject":"[PATCH 2/2] gitview: run blame with -C -C","fromName":"Aneesh Kumar K.V","fromEmail":"aneesh.kumar@gmail.com","sentAt":"2007-06-13T08:46:16Z","receivedAt":"2007-06-13T08:46:16Z","isPatch":true,"sender":{"key":"aneesh.kumar@gmail.com","avatar":"https://gravatar.com/avatar/0621fc0b2f14ead1e9024382f16053a808c148596da30c1b92572fa075621f68?d=mp&s=160"},"body":"From: Aneesh Kumar K.V <aneesh.kumar@gmail.com>\n\npass -C -C option to git-blame so that blame browsing\nworks when the data is copied over from other files.\n\nSigned-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>\n---\n contrib/gitview/gitview |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/contrib/gitview/gitview b/contrib/gitview/gitview\nindex 93ecfc1..5931766 100755\n--- a/contrib/gitview/gitview\n+++ b/contrib/gitview/gitview\n@@ -533,7 +533,7 @@ class AnnotateWindow(object):\n \n \t\tself.add_file_data(filename, commit_sha1, line_num)\n \n-\t\tfp = os.popen(\"git blame --incremental -- \" + filename + \" \" + commit_sha1)\n+\t\tfp = os.popen(\"git blame --incremental -C -C -- \" + filename + \" \" + commit_sha1)\n \t\tflags = fcntl.fcntl(fp.fileno(), fcntl.F_GETFL)\n \t\tfcntl.fcntl(fp.fileno(), fcntl.F_SETFL, flags | os.O_NONBLOCK)\n \t\tself.io_watch_tag = gobject.io_add_watch(fp, gobject.IO_IN, self.data_ready)\n-- \n1.5.2.1.255.gca6c0-dirty\n"}]}