/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

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2007-01-30 16:05:15 UTC
  • mto: (157.1.2 trunk) (170.1.3 trunk)
  • mto: This revision was merged to the branch mainline in revision 138.
  • Revision ID: szilveszter.farkas@gmail.com-20070130160515-1mh5hm2ppdmuq6l1
Added revert functionality to the context menu.

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