Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@gmail.com>2007-06-13 12:46:15 +0400
committerJunio C Hamano <gitster@pobox.com>2007-06-13 13:14:20 +0400
commit30a844874db6ee25b6f54ea786f0adabd8e074d7 (patch)
treeab821e80ad977a68df8548b63204b9b01f63d282
parent4175e9e3a8734be1e96e385b0fa2428b86ed5809 (diff)
gitview: Fix the blame interface.
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>
-rwxr-xr-xcontrib/gitview/gitview19
1 files changed, 18 insertions, 1 deletions
diff --git a/contrib/gitview/gitview b/contrib/gitview/gitview
index 098cb01353..93ecfc1bb9 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)