bzr branch
http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
505.1.1
by Jelmer Vernooij
Make handle-patch not dependend on the users name being abentley and install it. |
1 |
#!/usr/bin/python
|
2 |
||
3 |
from bzrlib import errors, merge_directive |
|
4 |
from bzrlib.plugin import load_plugins |
|
772.2.3
by Curtis Hovey
Fixed gtk call and import order. |
5 |
load_plugins() |
727
by Fabio Zanini
Fix import of open_display in bzr-handle-patch. |
6 |
from bzrlib.plugins.gtk.commands import open_display |
7 |
||
505.1.1
by Jelmer Vernooij
Make handle-patch not dependend on the users name being abentley and install it. |
8 |
import sys |
9 |
||
10 |
if len(sys.argv) < 2: |
|
790
by Jelmer Vernooij
bzr-handle-patch: Use spaces rather than tabs for indentation. |
11 |
print "Usage: handle-patch <path>" |
12 |
sys.exit(1) |
|
505.1.1
by Jelmer Vernooij
Make handle-patch not dependend on the users name being abentley and install it. |
13 |
|
14 |
||
15 |
path = sys.argv[1] |
|
16 |
||
17 |
try: |
|
790
by Jelmer Vernooij
bzr-handle-patch: Use spaces rather than tabs for indentation. |
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) |
|
505.1.1
by Jelmer Vernooij
Make handle-patch not dependend on the users name being abentley and install it. |
35 |
except Exception, e: |
790
by Jelmer Vernooij
bzr-handle-patch: Use spaces rather than tabs for indentation. |
36 |
from bzrlib.plugins.gtk.dialog import error_dialog |
37 |
error_dialog('Error', str(e)) |
|
38 |
raise
|
|
772.2.4
by Curtis Hovey
Added a smoketest for bzr-handle-patch. |
39 |
|
40 |
if len(sys.argv) == 3 and sys.argv[2] == 'test': |
|
41 |
sys.exit(0) |
|
42 |
||
772.2.3
by Curtis Hovey
Fixed gtk call and import order. |
43 |
Gtk.main() |