* [PATCH 1/2] gitview: Fix the blame interface. [not found] <142a3f15cd43680e0d7a02f09ffdd93864d13871.1181724308.git.aneesh.kumar@linux.vnet.ibm.com> @ 2007-06-13 8:46 ` Aneesh Kumar K.V [not found] ` <6973094c1fe2fda471e09cac231457da8802a392.1181724308.git.aneesh.kumar@linux.vnet.ibm.com> 1 sibling, 0 replies; 5+ messages in thread From: Aneesh Kumar K.V @ 2007-06-13 8:46 UTC (permalink / raw) To: git; +Cc: gitster, Aneesh Kumar K.V The async reading from the pipe was skipping some of the input lines. Fix the same by making sure that we add the partial content of the previous read to the newly read data. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com> --- contrib/gitview/gitview | 19 ++++++++++++++++++- 1 files changed, 18 insertions(+), 1 deletions(-) diff --git a/contrib/gitview/gitview b/contrib/gitview/gitview index 098cb01..93ecfc1 100755 --- a/contrib/gitview/gitview +++ b/contrib/gitview/gitview @@ -352,6 +352,7 @@ class AnnotateWindow(object): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_border_width(0) self.window.set_title("Git repository browser annotation window") + self.prev_read = "" # Use two thirds of the screen by default screen = self.window.get_screen() @@ -401,7 +402,10 @@ class AnnotateWindow(object): def data_ready(self, source, condition): while (1): try : - buffer = source.read(8192) + # A simple readline doesn't work + # a readline bug ?? + buffer = source.read(100) + except: # resource temporary not available return True @@ -411,6 +415,19 @@ class AnnotateWindow(object): source.close() return False + if (self.prev_read != ""): + buffer = self.prev_read + buffer + self.prev_read = "" + + if (buffer[len(buffer) -1] != '\n'): + try: + newline_index = buffer.rindex("\n") + except ValueError: + newline_index = 0 + + self.prev_read = buffer[newline_index:(len(buffer))] + buffer = buffer[0:newline_index] + for buff in buffer.split("\n"): annotate_line = re.compile('^([0-9a-f]{40}) (.+) (.+) (.+)$') m = annotate_line.match(buff) -- 1.5.2.1.255.gca6c0-dirty ^ permalink raw reply related [flat|nested] 5+ messages in thread
[parent not found: <6973094c1fe2fda471e09cac231457da8802a392.1181724308.git.aneesh.kumar@linux.vnet.ibm.com>]
* [PATCH 2/2] gitview: run blame with -C -C [not found] ` <6973094c1fe2fda471e09cac231457da8802a392.1181724308.git.aneesh.kumar@linux.vnet.ibm.com> @ 2007-06-13 8:46 ` Aneesh Kumar K.V 0 siblings, 0 replies; 5+ messages in thread From: Aneesh Kumar K.V @ 2007-06-13 8:46 UTC (permalink / raw) To: git; +Cc: gitster, Aneesh Kumar K.V From: Aneesh Kumar K.V <aneesh.kumar@gmail.com> pass -C -C option to git-blame so that blame browsing works when the data is copied over from other files. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com> --- contrib/gitview/gitview | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/contrib/gitview/gitview b/contrib/gitview/gitview index 93ecfc1..5931766 100755 --- a/contrib/gitview/gitview +++ b/contrib/gitview/gitview @@ -533,7 +533,7 @@ class AnnotateWindow(object): self.add_file_data(filename, commit_sha1, line_num) - fp = os.popen("git blame --incremental -- " + filename + " " + commit_sha1) + fp = os.popen("git blame --incremental -C -C -- " + filename + " " + commit_sha1) flags = fcntl.fcntl(fp.fileno(), fcntl.F_GETFL) fcntl.fcntl(fp.fileno(), fcntl.F_SETFL, flags | os.O_NONBLOCK) self.io_watch_tag = gobject.io_add_watch(fp, gobject.IO_IN, self.data_ready) -- 1.5.2.1.255.gca6c0-dirty ^ permalink raw reply related [flat|nested] 5+ messages in thread
[parent not found: <392459374618773353ea560d021dd3211d143d86.1181669428.git.aneesh.kumar@gmail.com>]
* [PATCH 1/2] gitview: Fix the blame interface. [not found] <392459374618773353ea560d021dd3211d143d86.1181669428.git.aneesh.kumar@gmail.com> @ 2007-06-12 17:35 ` Aneesh Kumar K.V 2007-06-13 4:58 ` Junio C Hamano 0 siblings, 1 reply; 5+ messages in thread From: Aneesh Kumar K.V @ 2007-06-12 17:35 UTC (permalink / raw) To: git; +Cc: Aneesh Kumar K.V The async reading from the pipe was skipping some of the input lines. Fix the same by making sure that we add the partial content of the previous read to the newly read data. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com> --- contrib/gitview/gitview | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-) diff --git a/contrib/gitview/gitview b/contrib/gitview/gitview index 098cb01..286e974 100755 --- a/contrib/gitview/gitview +++ b/contrib/gitview/gitview @@ -352,6 +352,7 @@ class AnnotateWindow(object): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_border_width(0) self.window.set_title("Git repository browser annotation window") + self.prev_read = "" # Use two thirds of the screen by default screen = self.window.get_screen() @@ -401,7 +402,11 @@ class AnnotateWindow(object): def data_ready(self, source, condition): while (1): try : - buffer = source.read(8192) + # A simple readline doesn't work + # a readline bug ?? + buffer="" + buffer = source.read(100) + except: # resource temporary not available return True @@ -411,6 +416,14 @@ class AnnotateWindow(object): source.close() return False + if (self.prev_read != ""): + buffer = self.prev_read + buffer + self.prev_read = "" + + if (buffer[len(buffer) -1] != '\n'): + self.prev_read = buffer[buffer.rindex("\n"):(len(buffer))] + buffer = buffer[0:buffer.rindex("\n")] + for buff in buffer.split("\n"): annotate_line = re.compile('^([0-9a-f]{40}) (.+) (.+) (.+)$') m = annotate_line.match(buff) @@ -419,7 +432,8 @@ class AnnotateWindow(object): m = annotate_line.match(buff) if not m: continue - filename = m.group(2) + else: + filename = m.group(2) else: self.commit_sha1 = m.group(1) self.source_line = int(m.group(2)) -- 1.5.2.1.239.g75d8-dirty ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] gitview: Fix the blame interface. 2007-06-12 17:35 ` [PATCH 1/2] gitview: Fix the blame interface Aneesh Kumar K.V @ 2007-06-13 4:58 ` Junio C Hamano 2007-06-13 8:33 ` Aneesh Kumar 0 siblings, 1 reply; 5+ messages in thread From: Junio C Hamano @ 2007-06-13 4:58 UTC (permalink / raw) To: Aneesh Kumar K.V; +Cc: git "Aneesh Kumar K.V" <aneesh.kumar@gmail.com> writes: > @@ -401,7 +402,11 @@ class AnnotateWindow(object): > def data_ready(self, source, condition): > while (1): > try : > - buffer = source.read(8192) > + # A simple readline doesn't work > + # a readline bug ?? > + buffer="" > + buffer = source.read(100) > + Are you sure about the first assignment? > @@ -419,7 +432,8 @@ class AnnotateWindow(object): > m = annotate_line.match(buff) > if not m: > continue > - filename = m.group(2) > + else: > + filename = m.group(2) > else: > self.commit_sha1 = m.group(1) > self.source_line = int(m.group(2)) The script is in contrib/ so I probably shouldn't be nitpicking, but for this particular hunk, I think (1) this is a no-op change, and (2) the original is easier to read. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] gitview: Fix the blame interface. 2007-06-13 4:58 ` Junio C Hamano @ 2007-06-13 8:33 ` Aneesh Kumar 0 siblings, 0 replies; 5+ messages in thread From: Aneesh Kumar @ 2007-06-13 8:33 UTC (permalink / raw) To: Junio C Hamano; +Cc: Git Mailing List On 6/13/07, Junio C Hamano <gitster@pobox.com> wrote: > "Aneesh Kumar K.V" <aneesh.kumar@gmail.com> writes: > > > @@ -401,7 +402,11 @@ class AnnotateWindow(object): > > def data_ready(self, source, condition): > > while (1): > > try : > > - buffer = source.read(8192) > > + # A simple readline doesn't work > > + # a readline bug ?? > > + buffer="" > > + buffer = source.read(100) > > + > > Are you sure about the first assignment? > That was a debug left over i guess. I will send an update patch which removed the same. The problem was an interrupted source.read/readline was returning old values. > > @@ -419,7 +432,8 @@ class AnnotateWindow(object): > > m = annotate_line.match(buff) > > if not m: > > continue > > - filename = m.group(2) > > + else: > > + filename = m.group(2) > > else: > > self.commit_sha1 = m.group(1) > > self.source_line = int(m.group(2)) > > The script is in contrib/ so I probably shouldn't be nitpicking, > but for this particular hunk, I think (1) this is a no-op > change, and (2) the original is easier to read. > > I will update if you feel that way -aneesh ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-06-13 8:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <142a3f15cd43680e0d7a02f09ffdd93864d13871.1181724308.git.aneesh.kumar@linux.vnet.ibm.com>
2007-06-13 8:46 ` [PATCH 1/2] gitview: Fix the blame interface Aneesh Kumar K.V
[not found] ` <6973094c1fe2fda471e09cac231457da8802a392.1181724308.git.aneesh.kumar@linux.vnet.ibm.com>
2007-06-13 8:46 ` [PATCH 2/2] gitview: run blame with -C -C Aneesh Kumar K.V
[not found] <392459374618773353ea560d021dd3211d143d86.1181669428.git.aneesh.kumar@gmail.com>
2007-06-12 17:35 ` [PATCH 1/2] gitview: Fix the blame interface Aneesh Kumar K.V
2007-06-13 4:58 ` Junio C Hamano
2007-06-13 8:33 ` Aneesh Kumar
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).