/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: Szilveszter Farkas (Phanatic)
  • Date: 2008-03-03 17:24:22 UTC
  • mto: This revision was merged to the branch mainline in revision 435.
  • Revision ID: szilveszter.farkas@gmail.com-20080303172422-y1u0gg7kyirrxuun
Installing an olive package is pretty useless. (Fixed: #136432)

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
except ImportError:
31
31
    have_gconf = False
32
32
 
33
 
from bzrlib import (
34
 
    merge as _mod_merge,
35
 
    osutils,
36
 
    progress,
37
 
    urlutils,
38
 
    workingtree,
39
 
)
 
33
from bzrlib import merge as _mod_merge, osutils, progress, workingtree
40
34
from bzrlib.diff import show_diff_trees, internal_diff
41
35
from bzrlib.errors import NoSuchFile
42
36
from bzrlib.patches import parse_patches
227
221
#        self.parent_tree.lock_read()
228
222
#        self.rev_tree.lock_read()
229
223
#        try:
230
 
#            self.delta = iter_changes_to_status(self.parent_tree, self.rev_tree)
 
224
#            self.delta = _iter_changes_to_status(self.parent_tree, self.rev_tree)
231
225
#            self.path_to_status = {}
232
226
#            self.path_to_diff = {}
233
227
#            source_inv = self.parent_tree.inventory
469
463
 
470
464
class MergeDirectiveWindow(DiffWindow):
471
465
 
472
 
    def __init__(self, directive, path):
473
 
        DiffWindow.__init__(self, None)
 
466
    def __init__(self, directive, parent=None):
 
467
        DiffWindow.__init__(self, parent)
474
468
        self._merge_target = None
475
469
        self.directive = directive
476
 
        self.path = path
477
470
 
478
471
    def _get_button_bar(self):
479
472
        """The button bar has only the Merge button"""
482
475
        merge_button.set_relief(gtk.RELIEF_NONE)
483
476
        merge_button.connect("clicked", self.perform_merge)
484
477
 
485
 
        save_button = gtk.Button('Save')
486
 
        save_button.show()
487
 
        save_button.set_relief(gtk.RELIEF_NONE)
488
 
        save_button.connect("clicked", self.perform_save)
489
 
 
490
478
        hbox = gtk.HButtonBox()
491
479
        hbox.set_layout(gtk.BUTTONBOX_START)
492
480
        hbox.pack_start(merge_button, expand=False, fill=True)
493
 
        hbox.pack_start(save_button, expand=False, fill=True)
494
481
        hbox.show()
495
482
        return hbox
496
483
 
540
527
            d.destroy()
541
528
        return workingtree.WorkingTree.open(uri)
542
529
 
543
 
    def perform_save(self, window):
544
 
        d = gtk.FileChooserDialog('Save As', self,
545
 
                                  gtk.FILE_CHOOSER_ACTION_SAVE,
546
 
                                  buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK,
547
 
                                           gtk.STOCK_CANCEL,
548
 
                                           gtk.RESPONSE_CANCEL,))
549
 
        d.set_current_name(osutils.basename(self.path))
550
 
        try:
551
 
            try:
552
 
                result = d.run()
553
 
                if result != gtk.RESPONSE_OK:
554
 
                    raise SelectCancelled()
555
 
                uri = d.get_uri()
556
 
            finally:
557
 
                d.destroy()
558
 
        except SelectCancelled:
559
 
            return
560
 
        source = open(self.path, 'rb')
561
 
        try:
562
 
            target = open(urlutils.local_path_from_url(uri), 'wb')
563
 
            try:
564
 
                target.write(source.read())
565
 
            finally:
566
 
                target.close()
567
 
        finally:
568
 
            source.close()
569
 
 
570
 
 
571
 
def iter_changes_to_status(source, target):
 
530
 
 
531
def _iter_changes_to_status(source, target):
572
532
    """Determine the differences between trees.
573
533
 
574
 
    This is a wrapper around iter_changes which just yields more
 
534
    This is a wrapper around _iter_changes which just yields more
575
535
    understandable results.
576
536
 
577
537
    :param source: The source tree (basis tree)
593
553
        source.lock_read()
594
554
        try:
595
555
            for (file_id, paths, changed_content, versioned, parent_ids, names,
596
 
                 kinds, executables) in target.iter_changes(source):
 
556
                 kinds, executables) in target._iter_changes(source):
597
557
 
598
558
                # Skip the root entry if it isn't very interesting
599
559
                if parent_ids == (None, None):