/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: Jelmer Vernooij
  • Date: 2008-06-29 19:07:23 UTC
  • mto: This revision was merged to the branch mainline in revision 515.
  • Revision ID: jelmer@samba.org-20080629190723-l8mzg9x4oec0lhsl
Return cleartext from seahorse module

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