/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: Jelmer Vernooij
  • Date: 2012-07-09 15:23:26 UTC
  • mto: This revision was merged to the branch mainline in revision 794.
  • Revision ID: jelmer@samba.org-20120709152326-dzxb8zoz0btull7n
Remove bzr-notify.

Show diffs side-by-side

added added

removed removed

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