X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=contrib%2Fgitview%2Fgitview;h=593176662050f0c84897759ab7d80f31aabfae53;hb=b8de7f764e1a9f6e8dfb587a6145906394fa607d;hp=2d80e2bad2e6f322d7ff7e9f03a6897a11f74231;hpb=aff787b52bc8e1d7fcfce5d28d1fc569f905d3c1;p=git.git diff --git a/contrib/gitview/gitview b/contrib/gitview/gitview index 2d80e2bad..593176662 100755 --- a/contrib/gitview/gitview +++ b/contrib/gitview/gitview @@ -259,10 +259,13 @@ class CellRendererGraph(gtk.GenericCellRenderer): self.set_colour(ctx, colour, 0.0, 0.5) ctx.show_text(name) -class Commit: +class Commit(object): """ This represent a commit object obtained after parsing the git-rev-list output """ + __slots__ = ['children_sha1', 'message', 'author', 'date', 'committer', + 'commit_date', 'commit_sha1', 'parent_sha1'] + children_sha1 = {} def __init__(self, commit_lines): @@ -339,7 +342,7 @@ class Commit: fp.close() return diff -class AnnotateWindow: +class AnnotateWindow(object): """Annotate window. This object represents and manages a single window containing the annotate information of the file @@ -349,6 +352,7 @@ class AnnotateWindow: 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() @@ -398,7 +402,10 @@ class AnnotateWindow: 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 @@ -408,6 +415,19 @@ class AnnotateWindow: 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) @@ -513,13 +533,13 @@ class AnnotateWindow: 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) -class DiffWindow: +class DiffWindow(object): """Diff window. This object represents and manages a single window containing the differences between two revisions on a branch. @@ -674,7 +694,7 @@ class DiffWindow: fp.close() dialog.destroy() -class GitView: +class GitView(object): """ This is the main class """ version = "0.9" @@ -1277,5 +1297,3 @@ if __name__ == "__main__": view = GitView( without_diff != 1) view.run(sys.argv[without_diff:]) - -