summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4175e9e)
raw | patch | inline | side by side (parent: 4175e9e)
author | Aneesh Kumar K.V <aneesh.kumar@gmail.com> | |
Wed, 13 Jun 2007 08:46:15 +0000 (14:16 +0530) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 13 Jun 2007 09:14:20 +0000 (02:14 -0700) |
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/gitview/gitview | patch | blob | history |
index 098cb01353d4adbfd32bdd4f70183b4b474f2158..93ecfc1bb919162940b7c92493c1cad025ba47cb 100755 (executable)
--- a/contrib/gitview/gitview
+++ b/contrib/gitview/gitview
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()
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
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)