~ubuntu-branches/ubuntu/intrepid/git-core/intrepid-security

« back to all changes in this revision

Viewing changes to contrib/gitview/gitview

  • Committer: Package Import Robot
  • Author(s): Gerrit Pape
  • Date: 2007-10-04 08:27:01 UTC
  • mfrom: (1.1.23)
  • Revision ID: package-import@ubuntu.com-20071004082701-rsd058ontoqz4i30
Tags: 1:1.5.3.4-1
new upstream point release (closes: #445188).

Show diffs side-by-side

added added

removed removed

Lines of Context:
259
259
                                self.set_colour(ctx, colour, 0.0, 0.5)
260
260
                        ctx.show_text(name)
261
261
 
262
 
class Commit:
 
262
class Commit(object):
263
263
        """ This represent a commit object obtained after parsing the git-rev-list
264
264
        output """
265
265
 
 
266
        __slots__ = ['children_sha1', 'message', 'author', 'date', 'committer',
 
267
                                 'commit_date', 'commit_sha1', 'parent_sha1']
 
268
 
266
269
        children_sha1 = {}
267
270
 
268
271
        def __init__(self, commit_lines):
339
342
                fp.close()
340
343
                return diff
341
344
 
342
 
class AnnotateWindow:
 
345
class AnnotateWindow(object):
343
346
        """Annotate window.
344
347
        This object represents and manages a single window containing the
345
348
        annotate information of the file
349
352
                self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
350
353
                self.window.set_border_width(0)
351
354
                self.window.set_title("Git repository browser annotation window")
 
355
                self.prev_read = ""
352
356
 
353
357
                # Use two thirds of the screen by default
354
358
                screen = self.window.get_screen()
398
402
        def data_ready(self, source, condition):
399
403
                while (1):
400
404
                        try :
401
 
                                buffer = source.read(8192)
 
405
                                # A simple readline doesn't work
 
406
                                # a readline bug ??
 
407
                                buffer = source.read(100)
 
408
 
402
409
                        except:
403
410
                                # resource temporary not available
404
411
                                return True
408
415
                                source.close()
409
416
                                return False
410
417
 
 
418
                        if (self.prev_read != ""):
 
419
                                buffer = self.prev_read + buffer
 
420
                                self.prev_read = ""
 
421
 
 
422
                        if (buffer[len(buffer) -1] != '\n'):
 
423
                                try:
 
424
                                        newline_index = buffer.rindex("\n")
 
425
                                except ValueError:
 
426
                                        newline_index = 0
 
427
 
 
428
                                self.prev_read = buffer[newline_index:(len(buffer))]
 
429
                                buffer = buffer[0:newline_index]
 
430
 
411
431
                        for buff in buffer.split("\n"):
412
432
                                annotate_line = re.compile('^([0-9a-f]{40}) (.+) (.+) (.+)$')
413
433
                                m = annotate_line.match(buff)
513
533
 
514
534
                self.add_file_data(filename, commit_sha1, line_num)
515
535
 
516
 
                fp = os.popen("git blame --incremental -- " + filename + " " + commit_sha1)
 
536
                fp = os.popen("git blame --incremental -C -C -- " + filename + " " + commit_sha1)
517
537
                flags = fcntl.fcntl(fp.fileno(), fcntl.F_GETFL)
518
538
                fcntl.fcntl(fp.fileno(), fcntl.F_SETFL, flags | os.O_NONBLOCK)
519
539
                self.io_watch_tag = gobject.io_add_watch(fp, gobject.IO_IN, self.data_ready)
520
540
 
521
541
 
522
 
class DiffWindow:
 
542
class DiffWindow(object):
523
543
        """Diff window.
524
544
        This object represents and manages a single window containing the
525
545
        differences between two revisions on a branch.
674
694
                        fp.close()
675
695
                dialog.destroy()
676
696
 
677
 
class GitView:
 
697
class GitView(object):
678
698
        """ This is the main class
679
699
        """
680
700
        version = "0.9"
1277
1297
 
1278
1298
        view = GitView( without_diff != 1)
1279
1299
        view.run(sys.argv[without_diff:])
1280
 
 
1281