/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 diff.py

  • Committer: David Planella
  • Date: 2011-03-06 08:24:07 UTC
  • mfrom: (718 trunk)
  • mto: This revision was merged to the branch mainline in revision 719.
  • Revision ID: david.planella@ubuntu.com-20110306082407-y9zwkjje5oue9egw
Added preliminary internationalization support. Merged from trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
"""
6
6
 
7
7
__copyright__ = "Copyright 2005 Canonical Ltd."
8
 
__author__ = "Scott James Remnant <scott@ubuntu.com>"
 
8
__author__    = "Scott James Remnant <scott@ubuntu.com>"
9
9
 
10
10
 
11
11
from cStringIO import StringIO
12
12
 
 
13
import pygtk
 
14
pygtk.require("2.0")
 
15
import gtk
 
16
import pango
 
17
import os
 
18
import re
13
19
import sys
14
20
import inspect
 
21
try:
 
22
    from xml.etree.ElementTree import Element, SubElement, tostring
 
23
except ImportError:
 
24
    from elementtree.ElementTree import Element, SubElement, tostring
15
25
 
16
 
from gi.repository import Gtk
17
 
from gi.repository import Pango
18
26
try:
19
 
    from gi.repository import GtkSource
 
27
    import gtksourceview2
20
28
    have_gtksourceview = True
21
29
except ImportError:
22
30
    have_gtksourceview = False
 
31
try:
 
32
    import gconf
 
33
    have_gconf = True
 
34
except ImportError:
 
35
    have_gconf = False
23
36
 
24
37
from bzrlib import (
25
38
    errors,
27
40
    osutils,
28
41
    urlutils,
29
42
    workingtree,
30
 
    )
31
 
from bzrlib.diff import show_diff_trees
 
43
)
 
44
from bzrlib.diff import show_diff_trees, internal_diff
32
45
from bzrlib.patches import parse_patches
33
 
from bzrlib.plugins.gtk.dialog import (
34
 
    error_dialog,
35
 
    info_dialog,
36
 
    warning_dialog,
37
 
    )
38
 
from bzrlib.plugins.gtk.i18n import _i18n
 
46
from bzrlib.trace import warning
 
47
from bzrlib.plugins.gtk import _i18n
39
48
from bzrlib.plugins.gtk.window import Window
 
49
from dialog import error_dialog, info_dialog, warning_dialog
40
50
 
41
51
 
42
52
def fallback_guess_language(slm, content_type):
52
62
    pass
53
63
 
54
64
 
55
 
class DiffFileView(Gtk.ScrolledWindow):
 
65
class DiffFileView(gtk.ScrolledWindow):
56
66
    """Window for displaying diffs from a diff file"""
57
67
 
58
 
    SHOW_WIDGETS = True
59
 
 
60
68
    def __init__(self):
61
 
        super(DiffFileView, self).__init__()
 
69
        gtk.ScrolledWindow.__init__(self)
62
70
        self.construct()
63
71
        self._diffs = {}
64
72
 
65
73
    def construct(self):
66
 
        self.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
67
 
        self.set_shadow_type(Gtk.ShadowType.IN)
 
74
        self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
 
75
        self.set_shadow_type(gtk.SHADOW_IN)
68
76
 
69
77
        if have_gtksourceview:
70
 
            self.buffer = GtkSource.Buffer()
71
 
            lang_manager = GtkSource.LanguageManager.get_default()
72
 
            language = lang_manager.guess_language(None, "text/x-patch")
73
 
            self.buffer.set_language(language)
 
78
            self.buffer = gtksourceview2.Buffer()
 
79
            slm = gtksourceview2.LanguageManager()
 
80
            guess_language = getattr(gtksourceview2.LanguageManager, 
 
81
                "guess_language", fallback_guess_language)
 
82
            gsl = guess_language(slm, content_type="text/x-patch")
 
83
            if have_gconf:
 
84
                self.apply_gedit_colors(self.buffer)
 
85
            self.apply_colordiff_colors(self.buffer)
 
86
            self.buffer.set_language(gsl)
74
87
            self.buffer.set_highlight_syntax(True)
75
 
            self.sourceview = GtkSource.View(buffer=self.buffer)
 
88
 
 
89
            self.sourceview = gtksourceview2.View(self.buffer)
76
90
        else:
77
 
            self.buffer = Gtk.TextBuffer()
78
 
            self.sourceview = Gtk.TextView(self.buffer)
 
91
            self.buffer = gtk.TextBuffer()
 
92
            self.sourceview = gtk.TextView(self.buffer)
79
93
 
80
94
        self.sourceview.set_editable(False)
81
 
        self.sourceview.override_font(Pango.FontDescription("Monospace"))
 
95
        self.sourceview.modify_font(pango.FontDescription("Monospace"))
82
96
        self.add(self.sourceview)
83
 
        if self.SHOW_WIDGETS:
84
 
            self.sourceview.show()
 
97
        self.sourceview.show()
 
98
 
 
99
    @staticmethod
 
100
    def apply_gedit_colors(buf):
 
101
        """Set style to that specified in gedit configuration.
 
102
 
 
103
        This method needs the gconf module.
 
104
 
 
105
        :param buf: a gtksourceview2.Buffer object.
 
106
        """
 
107
        GEDIT_SCHEME_PATH = '/apps/gedit-2/preferences/editor/colors/scheme'
 
108
        GEDIT_USER_STYLES_PATH = os.path.expanduser('~/.gnome2/gedit/styles')
 
109
 
 
110
        client = gconf.client_get_default()
 
111
        style_scheme_name = client.get_string(GEDIT_SCHEME_PATH)
 
112
        if style_scheme_name is not None:
 
113
            style_scheme_mgr = gtksourceview2.StyleSchemeManager()
 
114
            style_scheme_mgr.append_search_path(GEDIT_USER_STYLES_PATH)
 
115
            
 
116
            style_scheme = style_scheme_mgr.get_scheme(style_scheme_name)
 
117
            
 
118
            if style_scheme is not None:
 
119
                buf.set_style_scheme(style_scheme)
 
120
 
 
121
    @classmethod
 
122
    def apply_colordiff_colors(klass, buf):
 
123
        """Set style colors for lang using the colordiff configuration file.
 
124
 
 
125
        Both ~/.colordiffrc and ~/.colordiffrc.bzr-gtk are read.
 
126
 
 
127
        :param buf: a "Diff" gtksourceview2.Buffer object.
 
128
        """
 
129
        scheme_manager = gtksourceview2.StyleSchemeManager()
 
130
        style_scheme = scheme_manager.get_scheme('colordiff')
 
131
        
 
132
        # if style scheme not found, we'll generate it from colordiffrc
 
133
        # TODO: reload if colordiffrc has changed.
 
134
        if style_scheme is None:
 
135
            colors = {}
 
136
 
 
137
            for f in ('~/.colordiffrc', '~/.colordiffrc.bzr-gtk'):
 
138
                f = os.path.expanduser(f)
 
139
                if os.path.exists(f):
 
140
                    try:
 
141
                        f = file(f)
 
142
                    except IOError, e:
 
143
                        warning('could not open file %s: %s' % (f, str(e)))
 
144
                    else:
 
145
                        colors.update(klass.parse_colordiffrc(f))
 
146
                        f.close()
 
147
 
 
148
            if not colors:
 
149
                # ~/.colordiffrc does not exist
 
150
                return
 
151
            
 
152
            mapping = {
 
153
                # map GtkSourceView2 scheme styles to colordiff names
 
154
                # since GSV is richer, accept new names for extra bits,
 
155
                # defaulting to old names if they're not present
 
156
                'diff:added-line': ['newtext'],
 
157
                'diff:removed-line': ['oldtext'],
 
158
                'diff:location': ['location', 'diffstuff'],
 
159
                'diff:file': ['file', 'diffstuff'],
 
160
                'diff:special-case': ['specialcase', 'diffstuff'],
 
161
            }
 
162
            
 
163
            converted_colors = {}
 
164
            for name, values in mapping.items():
 
165
                color = None
 
166
                for value in values:
 
167
                    color = colors.get(value, None)
 
168
                    if color is not None:
 
169
                        break
 
170
                if color is None:
 
171
                    continue
 
172
                converted_colors[name] = color
 
173
            
 
174
            # some xml magic to produce needed style scheme description
 
175
            e_style_scheme = Element('style-scheme')
 
176
            e_style_scheme.set('id', 'colordiff')
 
177
            e_style_scheme.set('_name', 'ColorDiff')
 
178
            e_style_scheme.set('version', '1.0')
 
179
            for name, color in converted_colors.items():
 
180
                style = SubElement(e_style_scheme, 'style')
 
181
                style.set('name', name)
 
182
                style.set('foreground', '#%s' % color)
 
183
            
 
184
            scheme_xml = tostring(e_style_scheme, 'UTF-8')
 
185
            if not os.path.exists(os.path.expanduser('~/.local/share/gtksourceview-2.0/styles')):
 
186
                os.makedirs(os.path.expanduser('~/.local/share/gtksourceview-2.0/styles'))
 
187
            file(os.path.expanduser('~/.local/share/gtksourceview-2.0/styles/colordiff.xml'), 'w').write(scheme_xml)
 
188
            
 
189
            scheme_manager.force_rescan()
 
190
            style_scheme = scheme_manager.get_scheme('colordiff')
 
191
        
 
192
        buf.set_style_scheme(style_scheme)
 
193
 
 
194
    @staticmethod
 
195
    def parse_colordiffrc(fileobj):
 
196
        """Parse fileobj as a colordiff configuration file.
 
197
 
 
198
        :return: A dict with the key -> value pairs.
 
199
        """
 
200
        colors = {}
 
201
        for line in fileobj:
 
202
            if re.match(r'^\s*#', line):
 
203
                continue
 
204
            if '=' not in line:
 
205
                continue
 
206
            key, val = line.split('=', 1)
 
207
            colors[key.strip()] = val.strip()
 
208
        return colors
85
209
 
86
210
    def set_trees(self, rev_tree, parent_tree):
87
211
        self.rev_tree = rev_tree
92
216
#        self.parent_tree.lock_read()
93
217
#        self.rev_tree.lock_read()
94
218
#        try:
95
 
#            self.delta = iter_changes_to_status(
96
 
#               self.parent_tree, self.rev_tree)
 
219
#            self.delta = iter_changes_to_status(self.parent_tree, self.rev_tree)
97
220
#            self.path_to_status = {}
98
221
#            self.path_to_diff = {}
99
222
#            source_inv = self.parent_tree.inventory
100
223
#            target_inv = self.rev_tree.inventory
101
224
#            for (file_id, real_path, change_type, display_path) in self.delta:
102
 
#                self.path_to_status[real_path] = u'=== %s %s' % (
103
 
#                    change_type, display_path)
 
225
#                self.path_to_status[real_path] = u'=== %s %s' % (change_type, display_path)
104
226
#                if change_type in ('modified', 'renamed and modified'):
105
227
#                    source_ie = source_inv[file_id]
106
228
#                    target_ie = target_inv[file_id]
108
230
#                    source_ie.diff(internal_diff, *old path, *old_tree,
109
231
#                                   *new_path, target_ie, self.rev_tree,
110
232
#                                   sio)
111
 
#                    self.path_to_diff[real_path] =
 
233
#                    self.path_to_diff[real_path] = 
112
234
#
113
235
#        finally:
114
236
#            self.rev_tree.unlock()
128
250
    """This is the soft and chewy filling for a DiffWindow."""
129
251
 
130
252
    def __init__(self):
131
 
        super(DiffView, self).__init__()
 
253
        DiffFileView.__init__(self)
132
254
        self.rev_tree = None
133
255
        self.parent_tree = None
134
256
 
158
280
        self.buffer.set_text(decoded.encode('UTF-8'))
159
281
 
160
282
 
161
 
class DiffWidget(Gtk.HPaned):
 
283
class DiffWidget(gtk.HPaned):
162
284
    """Diff widget
163
285
 
164
286
    """
165
 
 
166
 
    SHOW_WIDGETS = True
167
 
 
168
287
    def __init__(self):
169
288
        super(DiffWidget, self).__init__()
170
289
 
171
290
        # The file hierarchy: a scrollable treeview
172
 
        scrollwin = Gtk.ScrolledWindow()
173
 
        scrollwin.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
174
 
        scrollwin.set_shadow_type(Gtk.ShadowType.IN)
 
291
        scrollwin = gtk.ScrolledWindow()
 
292
        scrollwin.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
 
293
        scrollwin.set_shadow_type(gtk.SHADOW_IN)
175
294
        self.pack1(scrollwin)
176
 
        if self.SHOW_WIDGETS:
177
 
            scrollwin.show()
178
 
 
179
 
        self.model = Gtk.TreeStore(str, str)
180
 
        self.treeview = Gtk.TreeView(model=self.model)
 
295
        scrollwin.show()
 
296
        
 
297
        self.model = gtk.TreeStore(str, str)
 
298
        self.treeview = gtk.TreeView(self.model)
181
299
        self.treeview.set_headers_visible(False)
182
300
        self.treeview.set_search_column(1)
183
301
        self.treeview.connect("cursor-changed", self._treeview_cursor_cb)
184
302
        scrollwin.add(self.treeview)
185
 
        if self.SHOW_WIDGETS:
186
 
            self.treeview.show()
 
303
        self.treeview.show()
187
304
 
188
 
        cell = Gtk.CellRendererText()
 
305
        cell = gtk.CellRendererText()
189
306
        cell.set_property("width-chars", 20)
190
 
        column = Gtk.TreeViewColumn()
191
 
        column.pack_start(cell, True)
 
307
        column = gtk.TreeViewColumn()
 
308
        column.pack_start(cell, expand=True)
192
309
        column.add_attribute(cell, "text", 0)
193
310
        self.treeview.append_column(column)
194
311
 
204
321
        if getattr(self, 'diff_view', None) is None:
205
322
            self.diff_view = DiffFileView()
206
323
            self.pack2(self.diff_view)
207
 
        if self.SHOW_WIDGETS:
208
 
            self.diff_view.show()
 
324
        self.diff_view.show()
209
325
        for oldname, newname, patch in sections:
210
326
            self.diff_view._diffs[newname] = str(patch)
211
327
            if newname is None:
222
338
        if getattr(self, 'diff_view', None) is None:
223
339
            self.diff_view = DiffView()
224
340
            self.pack2(self.diff_view)
225
 
        if self.SHOW_WIDGETS:
226
 
            self.diff_view.show()
 
341
        self.diff_view.show()
227
342
        self.diff_view.set_trees(rev_tree, parent_tree)
228
343
        self.rev_tree = rev_tree
229
344
        self.parent_tree = parent_tree
231
346
        self.model.clear()
232
347
        delta = self.rev_tree.changes_from(self.parent_tree)
233
348
 
234
 
        self.model.append(None, ["Complete Diff", ""])
 
349
        self.model.append(None, [ "Complete Diff", "" ])
235
350
 
236
351
        if len(delta.added):
237
 
            titer = self.model.append(None, ["Added", None])
 
352
            titer = self.model.append(None, [ "Added", None ])
238
353
            for path, id, kind in delta.added:
239
 
                self.model.append(titer, [path, path])
 
354
                self.model.append(titer, [ path, path ])
240
355
 
241
356
        if len(delta.removed):
242
 
            titer = self.model.append(None, ["Removed", None])
 
357
            titer = self.model.append(None, [ "Removed", None ])
243
358
            for path, id, kind in delta.removed:
244
 
                self.model.append(titer, [path, path])
 
359
                self.model.append(titer, [ path, path ])
245
360
 
246
361
        if len(delta.renamed):
247
 
            titer = self.model.append(None, ["Renamed", None])
 
362
            titer = self.model.append(None, [ "Renamed", None ])
248
363
            for oldpath, newpath, id, kind, text_modified, meta_modified \
249
364
                    in delta.renamed:
250
 
                self.model.append(titer, [oldpath, newpath])
 
365
                self.model.append(titer, [ oldpath, newpath ])
251
366
 
252
367
        if len(delta.modified):
253
 
            titer = self.model.append(None, ["Modified", None])
 
368
            titer = self.model.append(None, [ "Modified", None ])
254
369
            for path, id, kind, text_modified, meta_modified in delta.modified:
255
 
                self.model.append(titer, [path, path])
 
370
                self.model.append(titer, [ path, path ])
256
371
 
257
372
        self.treeview.expand_all()
258
373
        self.diff_view.show_diff(None)
267
382
                    break
268
383
        if tv_path is None:
269
384
            raise errors.NoSuchFile(file_path)
270
 
        self.treeview.set_cursor(tv_path, None, False)
 
385
        self.treeview.set_cursor(tv_path)
271
386
        self.treeview.scroll_to_cell(tv_path)
272
387
 
273
388
    def _treeview_cursor_cb(self, *args):
274
389
        """Callback for when the treeview cursor changes."""
275
390
        (path, col) = self.treeview.get_cursor()
276
 
        if path is None:
277
 
            return
278
 
        specific_files = [self.model[path][1]]
279
 
        if specific_files == [None]:
280
 
            return
281
 
        elif specific_files == [""]:
 
391
        specific_files = [ self.model[path][1] ]
 
392
        if specific_files == [ None ]:
 
393
            return
 
394
        elif specific_files == [ "" ]:
282
395
            specific_files = None
283
 
 
 
396
        
284
397
        self.diff_view.show_diff(specific_files)
285
 
 
 
398
    
286
399
    def _on_wraplines_toggled(self, widget=None, wrap=False):
287
400
        """Callback for when the wrap lines checkbutton is toggled"""
288
401
        if wrap or widget.get_active():
289
 
            self.diff_view.sourceview.set_wrap_mode(Gtk.WrapMode.WORD)
 
402
            self.diff_view.sourceview.set_wrap_mode(gtk.WRAP_WORD)
290
403
        else:
291
 
            self.diff_view.sourceview.set_wrap_mode(Gtk.WrapMode.NONE)
292
 
 
 
404
            self.diff_view.sourceview.set_wrap_mode(gtk.WRAP_NONE)
293
405
 
294
406
class DiffWindow(Window):
295
407
    """Diff window.
298
410
    differences between two revisions on a branch.
299
411
    """
300
412
 
301
 
    SHOW_WIDGETS = True
302
 
 
303
413
    def __init__(self, parent=None, operations=None):
304
 
        super(DiffWindow, self).__init__(parent=parent)
 
414
        Window.__init__(self, parent)
305
415
        self.set_border_width(0)
306
 
        self.set_title("bzr diff")
 
416
        self.set_title("bzrk diff")
307
417
 
308
418
        # Use two thirds of the screen by default
309
419
        screen = self.get_screen()
315
425
 
316
426
    def construct(self, operations):
317
427
        """Construct the window contents."""
318
 
        self.vbox = Gtk.VBox()
 
428
        self.vbox = gtk.VBox()
319
429
        self.add(self.vbox)
320
 
        if self.SHOW_WIDGETS:
321
 
            self.vbox.show()
 
430
        self.vbox.show()
322
431
        self.diff = DiffWidget()
323
432
        self.vbox.pack_end(self.diff, True, True, 0)
324
 
        if self.SHOW_WIDGETS:
325
 
            self.diff.show_all()
 
433
        self.diff.show_all()
326
434
        # Build after DiffWidget to connect signals
327
435
        menubar = self._get_menu_bar()
328
436
        self.vbox.pack_start(menubar, False, False, 0)
329
437
        hbox = self._get_button_bar(operations)
330
438
        if hbox is not None:
331
439
            self.vbox.pack_start(hbox, False, True, 0)
332
 
 
 
440
        
 
441
    
333
442
    def _get_menu_bar(self):
334
 
        menubar = Gtk.MenuBar()
 
443
        menubar = gtk.MenuBar()
335
444
        # View menu
336
 
        mb_view = Gtk.MenuItem.new_with_mnemonic(_i18n("_View"))
337
 
        mb_view_menu = Gtk.Menu()
338
 
        mb_view_wrapsource = Gtk.CheckMenuItem.new_with_mnemonic(
339
 
            _i18n("Wrap _Long Lines"))
 
445
        mb_view = gtk.MenuItem(_i18n("_View"))
 
446
        mb_view_menu = gtk.Menu()
 
447
        mb_view_wrapsource = gtk.CheckMenuItem(_i18n("Wrap _Long Lines"))
340
448
        mb_view_wrapsource.connect('activate', self.diff._on_wraplines_toggled)
 
449
        mb_view_wrapsource.show()
341
450
        mb_view_menu.append(mb_view_wrapsource)
 
451
        mb_view.show()
342
452
        mb_view.set_submenu(mb_view_menu)
 
453
        mb_view.show()
343
454
        menubar.append(mb_view)
344
 
        if self.SHOW_WIDGETS:
345
 
            menubar.show_all()
 
455
        menubar.show()
346
456
        return menubar
347
 
 
 
457
    
348
458
    def _get_button_bar(self, operations):
349
459
        """Return a button bar to use.
350
460
 
352
462
        """
353
463
        if operations is None:
354
464
            return None
355
 
        hbox = Gtk.HButtonBox()
356
 
        hbox.set_layout(Gtk.ButtonBoxStyle.START)
 
465
        hbox = gtk.HButtonBox()
 
466
        hbox.set_layout(gtk.BUTTONBOX_START)
357
467
        for title, method in operations:
358
 
            merge_button = Gtk.Button(title)
359
 
            if self.SHOW_WIDGETS:
360
 
                merge_button.show()
361
 
            merge_button.set_relief(Gtk.ReliefStyle.NONE)
 
468
            merge_button = gtk.Button(title)
 
469
            merge_button.show()
 
470
            merge_button.set_relief(gtk.RELIEF_NONE)
362
471
            merge_button.connect("clicked", method)
363
 
            hbox.pack_start(merge_button, False, True, 0)
364
 
        if self.SHOW_WIDGETS:
365
 
            hbox.show()
 
472
            hbox.pack_start(merge_button, expand=False, fill=True)
 
473
        hbox.show()
366
474
        return hbox
367
475
 
368
476
    def _get_merge_target(self):
369
 
        d = Gtk.FileChooserDialog('Merge branch', self,
370
 
                                  Gtk.FileChooserAction.SELECT_FOLDER,
371
 
                                  buttons=(Gtk.STOCK_OK, Gtk.ResponseType.OK,
372
 
                                           Gtk.STOCK_CANCEL,
373
 
                                           Gtk.ResponseType.CANCEL,))
 
477
        d = gtk.FileChooserDialog('Merge branch', self,
 
478
                                  gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
 
479
                                  buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK,
 
480
                                           gtk.STOCK_CANCEL,
 
481
                                           gtk.RESPONSE_CANCEL,))
374
482
        try:
375
483
            result = d.run()
376
 
            if result != Gtk.ResponseType.OK:
 
484
            if result != gtk.RESPONSE_OK:
377
485
                raise SelectCancelled()
378
486
            return d.get_current_folder_uri()
379
487
        finally:
393
501
        error_dialog('Error', str(e))
394
502
 
395
503
    def _get_save_path(self, basename):
396
 
        d = Gtk.FileChooserDialog('Save As', self,
397
 
                                  Gtk.FileChooserAction.SAVE,
398
 
                                  buttons=(Gtk.STOCK_OK, Gtk.ResponseType.OK,
399
 
                                           Gtk.STOCK_CANCEL,
400
 
                                           Gtk.ResponseType.CANCEL,))
 
504
        d = gtk.FileChooserDialog('Save As', self,
 
505
                                  gtk.FILE_CHOOSER_ACTION_SAVE,
 
506
                                  buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK,
 
507
                                           gtk.STOCK_CANCEL,
 
508
                                           gtk.RESPONSE_CANCEL,))
401
509
        d.set_current_name(basename)
402
510
        try:
403
511
            result = d.run()
404
 
            if result != Gtk.ResponseType.OK:
 
512
            if result != gtk.RESPONSE_OK:
405
513
                raise SelectCancelled()
406
514
            return urlutils.local_path_from_url(d.get_uri())
407
515
        finally:
469
577
class MergeDirectiveController(DiffController):
470
578
 
471
579
    def __init__(self, path, directive, window=None):
472
 
        super(MergeDirectiveController, self).__init__(
473
 
            path, directive.patch.splitlines(True), window)
 
580
        DiffController.__init__(self, path, directive.patch.splitlines(True),
 
581
                                window)
474
582
        self.directive = directive
475
583
        self.merge_target = None
476
584