{"thread":{"id":"8574","subject":"[PATCH 1/2] gitview: Fix the blame interface.","startedAt":"2007-06-12T17:35:20Z","lastAt":"2007-06-13T08:33:21Z","messageCount":5,"participants":["Aneesh Kumar K.V","Junio C Hamano","Aneesh Kumar"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"44848","messageId":"11816697213806-git-send-email-aneesh.kumar@gmail.com","threadId":"8574","inReplyTo":null,"subject":"[PATCH 1/2] gitview: Fix the blame interface.","fromName":"Aneesh Kumar K.V","fromEmail":"aneesh.kumar@gmail.com","sentAt":"2007-06-12T17:35:20Z","receivedAt":"2007-06-12T17:35:20Z","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 |   18 ++++++++++++++++--\n 1 files changed, 16 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/gitview/gitview b/contrib/gitview/gitview\nindex 098cb01..286e974 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,11 @@ 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=\"\"\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 +416,14 @@ 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\tself.prev_read = buffer[buffer.rindex(\"\\n\"):(len(buffer))]\n+\t\t\t\tbuffer = buffer[0:buffer.rindex(\"\\n\")]\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@@ -419,7 +432,8 @@ class AnnotateWindow(object):\n \t\t\t\t\tm = annotate_line.match(buff)\n \t\t\t\t\tif not m:\n \t\t\t\t\t\tcontinue\n-\t\t\t\t\tfilename = m.group(2)\n+\t\t\t\t\telse:\n+\t\t\t\t\t\tfilename = m.group(2)\n \t\t\t\telse:\n \t\t\t\t\tself.commit_sha1 = m.group(1)\n \t\t\t\t\tself.source_line = int(m.group(2))\n-- \n1.5.2.1.239.g75d8-dirty\n"},{"id":"44849","messageId":"1181669728642-git-send-email-aneesh.kumar@gmail.com","threadId":"8574","inReplyTo":"11816697213806-git-send-email-aneesh.kumar@gmail.com","subject":"[PATCH 2/2] gitview: run blame with -M and -C","fromName":"Aneesh Kumar K.V","fromEmail":"aneesh.kumar@gmail.com","sentAt":"2007-06-12T17:35:21Z","receivedAt":"2007-06-12T17:35:21Z","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 -M  and -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 286e974..01128f4 100755\n--- a/contrib/gitview/gitview\n+++ b/contrib/gitview/gitview\n@@ -530,7 +530,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 -M -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.239.g75d8-dirty\n"},{"id":"44885","messageId":"7vmyz4h2nb.fsf@assigned-by-dhcp.pobox.com","threadId":"8574","inReplyTo":"11816697213806-git-send-email-aneesh.kumar@gmail.com","subject":"Re: [PATCH 1/2] gitview: Fix the blame interface.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-06-13T04:58:00Z","receivedAt":"2007-06-13T04:58:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Aneesh Kumar K.V\" <aneesh.kumar@gmail.com> writes:\n\n> @@ -401,7 +402,11 @@ 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=\"\"\n> +\t\t\t\tbuffer = source.read(100)\n> +\n\nAre you sure about the first assignment?\n\n> @@ -419,7 +432,8 @@ class AnnotateWindow(object):\n>  \t\t\t\t\tm = annotate_line.match(buff)\n>  \t\t\t\t\tif not m:\n>  \t\t\t\t\t\tcontinue\n> -\t\t\t\t\tfilename = m.group(2)\n> +\t\t\t\t\telse:\n> +\t\t\t\t\t\tfilename = m.group(2)\n>  \t\t\t\telse:\n>  \t\t\t\t\tself.commit_sha1 = m.group(1)\n>  \t\t\t\t\tself.source_line = int(m.group(2))\n\nThe script is in contrib/ so I probably shouldn't be nitpicking,\nbut for this particular hunk, I think (1) this is a no-op\nchange, and (2) the original is easier to read.\n"},{"id":"44886","messageId":"7vir9sh2l5.fsf@assigned-by-dhcp.pobox.com","threadId":"8574","inReplyTo":"1181669728642-git-send-email-aneesh.kumar@gmail.com","subject":"Re: [PATCH 2/2] gitview: run blame with -M and -C","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-06-13T04:59:18Z","receivedAt":"2007-06-13T04:59:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Aneesh Kumar K.V\" <aneesh.kumar@gmail.com> writes:\n\n> From: Aneesh Kumar K.V <aneesh.kumar@gmail.com>\n>\n> pass -M  and -C option to git-blame so that blame browsing\n> works when the data is copied over from other files.\n>\n> Signed-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>\n> diff --git a/contrib/gitview/gitview b/contrib/gitview/gitview\n> index 286e974..01128f4 100755\n> --- a/contrib/gitview/gitview\n> +++ b/contrib/gitview/gitview\n> @@ -530,7 +530,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 -M -C -C -- \" + filename + \" \" + commit_sha1)\n\nYou do not have to say \"-M -C -C\"; \"-C\" would imply \"-M\"\nanyway.\n"},{"id":"44903","messageId":"cc723f590706130133v3952e38yc4ceecc6cdc44365@mail.gmail.com","threadId":"8574","inReplyTo":"7vmyz4h2nb.fsf@assigned-by-dhcp.pobox.com","subject":"Re: [PATCH 1/2] gitview: Fix the blame interface.","fromName":"Aneesh Kumar","fromEmail":"aneesh.kumar@gmail.com","sentAt":"2007-06-13T08:33:21Z","receivedAt":"2007-06-13T08:33:21Z","isPatch":true,"sender":{"key":"aneesh.kumar@gmail.com","avatar":"https://gravatar.com/avatar/0621fc0b2f14ead1e9024382f16053a808c148596da30c1b92572fa075621f68?d=mp&s=160"},"body":"On 6/13/07, Junio C Hamano <gitster@pobox.com> wrote:\n> \"Aneesh Kumar K.V\" <aneesh.kumar@gmail.com> writes:\n>\n> > @@ -401,7 +402,11 @@ class AnnotateWindow(object):\n> >       def data_ready(self, source, condition):\n> >               while (1):\n> >                       try :\n> > -                             buffer = source.read(8192)\n> > +                             # A simple readline doesn't work\n> > +                             # a readline bug ??\n> > +                             buffer=\"\"\n> > +                             buffer = source.read(100)\n> > +\n>\n> Are you sure about the first assignment?\n>\n\nThat was a debug left over i guess. I will send an update patch which\nremoved the same.\nThe problem was an interrupted source.read/readline was returning old values.\n\n\n\n> > @@ -419,7 +432,8 @@ class AnnotateWindow(object):\n> >                                       m = annotate_line.match(buff)\n> >                                       if not m:\n> >                                               continue\n> > -                                     filename = m.group(2)\n> > +                                     else:\n> > +                                             filename = m.group(2)\n> >                               else:\n> >                                       self.commit_sha1 = m.group(1)\n> >                                       self.source_line = int(m.group(2))\n>\n> The script is in contrib/ so I probably shouldn't be nitpicking,\n> but for this particular hunk, I think (1) this is a no-op\n> change, and (2) the original is easier to read.\n>\n>\n\n\nI will update if you feel that way\n\n-aneesh\n"}]}