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

merge with main branches

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