/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to bzr-handle-patch

  • Committer: Curtis Hovey
  • Date: 2011-08-12 20:25:28 UTC
  • mto: This revision was merged to the branch mainline in revision 741.
  • Revision ID: sinzui.is@verizon.net-20110812202528-4xf4a2t23urx50d2
Updated gst to gtk3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
 
 
3
from bzrlib import errors, merge_directive
 
4
from bzrlib.plugin import load_plugins
 
5
from bzrlib.plugins.gtk.commands import open_display
 
6
 
 
7
load_plugins()
 
8
 
 
9
import sys
 
10
 
 
11
if len(sys.argv) < 2:
 
12
        print "Usage: handle-patch <path>"
 
13
        sys.exit(1)
 
14
 
 
15
 
 
16
path = sys.argv[1]
 
17
 
 
18
try:
 
19
        from bzrlib.plugins.gtk.diff import (DiffController,
 
20
                                                                                 MergeDirectiveController)
 
21
        if path == '-':
 
22
                lines = sys.stdin.readlines()
 
23
        else:
 
24
                lines = open(path, 'rb').readlines()
 
25
        lines = [l.replace('\r\n', '\n') for l in lines]
 
26
        try:
 
27
                directive = merge_directive.MergeDirective.from_lines(lines)
 
28
        except errors.NotAMergeDirective:
 
29
                controller = DiffController(path, lines, allow_dirty=True)
 
30
        else:
 
31
                controller = MergeDirectiveController(path, directive)
 
32
        window = controller.window
 
33
        window.show()
 
34
        Gtk = open_display()
 
35
        window.connect("destroy", gtk.main_quit)
 
36
except Exception, e:
 
37
        from bzrlib.plugins.gtk.dialog import error_dialog
 
38
        error_dialog('Error', str(e))
 
39
        raise
 
40
gtk.main()