/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: Aaron Bentley
  • Date: 2007-01-17 06:42:55 UTC
  • mto: This revision was merged to the branch mainline in revision 129.
  • Revision ID: aaron.bentley@utoronto.ca-20070117064255-x4gznz5e0lyjq3gk
Remove usused span selector

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