3
from bzrlib import errors, merge_directive
 
 
4
from bzrlib.plugin import load_plugins
 
 
5
from bzrlib.plugins.gtk import open_display
 
 
11
        print "Usage: handle-patch <path>"
 
 
18
        from bzrlib.plugins.gtk.diff import (DiffController,
 
 
19
                                                                                 MergeDirectiveController)
 
 
21
                lines = sys.stdin.readlines()
 
 
23
                lines = open(path, 'rb').readlines()
 
 
24
        lines = [l.replace('\r\n', '\n') for l in lines]
 
 
26
                directive = merge_directive.MergeDirective.from_lines(lines)
 
 
27
        except errors.NotAMergeDirective:
 
 
28
                controller = DiffController(path, lines)
 
 
30
                controller = MergeDirectiveController(path, directive)
 
 
31
        window = controller.window
 
 
34
        window.connect("destroy", gtk.main_quit)
 
 
36
        from dialog import error_dialog
 
 
37
        error_dialog('Error', str(e))