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