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

  • Committer: Vincent Ladeuil
  • Date: 2008-06-10 15:25:47 UTC
  • mto: This revision was merged to the branch mainline in revision 504.
  • Revision ID: v.ladeuil+lp@free.fr-20080610152547-dwmil1p8pd0mfpnl
Fix third failing test (thanks to jam).

* tests/test_commit.py:
(TestPendingRevisions.test_pending_revisions_multi_merge): Fix
provided by jam: bzr we now filter the pending merges so that only
the 'heads()' are included. We just ensure that the pending merges
contain the unique tips for the ancestries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
from bzrlib.branch import Branch
29
29
import bzrlib.errors as errors
 
30
from bzrlib.plugins.gtk import _i18n
30
31
 
31
32
from dialog import error_dialog, info_dialog, warning_dialog
32
33
from errors import show_bzr_error
35
36
 
36
37
class MergeDialog:
37
38
    """ Display the Merge dialog and perform the needed actions. """
38
 
    def __init__(self, wt, wtpath):
 
39
    def __init__(self, wt, wtpath,default_branch_path=None):
39
40
        """ Initialize the Merge dialog. """
40
41
        self.glade = gtk.glade.XML(GLADEFILENAME, 'window_merge', 'olive-gtk')
41
42
        
54
55
        
55
56
        # Get some widgets
56
57
        self.entry = self.glade.get_widget('entry_merge')
 
58
        if default_branch_path:
 
59
            self.entry.set_text(default_branch_path)
57
60
 
58
61
    def display(self):
59
62
        """ Display the Add file(s) dialog. """
63
66
    def merge(self, widget):
64
67
        branch = self.entry.get_text()
65
68
        if branch == "":
66
 
            error_dialog(_('Branch not given'),
67
 
                         _('Please specify a branch to merge from.'))
 
69
            error_dialog(_i18n('Branch not given'),
 
70
                         _i18n('Please specify a branch to merge from.'))
68
71
            return
69
72
 
70
73
        other_branch = Branch.open_containing(branch)[0]
72
75
        try:
73
76
            conflicts = self.wt.merge_from_branch(other_branch)
74
77
        except errors.BzrCommandError, errmsg:
75
 
            error_dialog(_('Bazaar command error'), str(errmsg))
 
78
            error_dialog(_i18n('Bazaar command error'), str(errmsg))
76
79
            return
77
80
        
78
81
        self.close()
79
82
        if conflicts == 0:
80
83
            # No conflicts found.
81
 
            info_dialog(_('Merge successful'),
82
 
                        _('All changes applied successfully.'))
 
84
            info_dialog(_i18n('Merge successful'),
 
85
                        _i18n('All changes applied successfully.'))
83
86
        else:
84
87
            # There are conflicts to be resolved.
85
 
            warning_dialog(_('Conflicts encountered'),
86
 
                           _('Please resolve the conflicts manually before committing.'))
 
88
            warning_dialog(_i18n('Conflicts encountered'),
 
89
                           _i18n('Please resolve the conflicts manually before committing.'))
87
90
    
88
91
    def open(self, widget):
89
92
        fcd = gtk.FileChooserDialog(title="Please select a folder",