28
from bzrlib.branch import Branch
28
29
import bzrlib.errors as errors
30
31
from __init__ import gladefile
31
from dialog import error_dialog
32
from dialog import error_dialog, info_dialog, warning_dialog
34
35
""" Display the Merge dialog and perform the needed actions. """
50
51
self.wtpath = wtpath
54
self.entry = self.glade.get_widget('entry_merge')
53
57
""" Display the Add file(s) dialog. """
54
58
self.window.show_all()
56
60
def merge(self, widget):
57
print "DEBUG: Merge button pressed."
61
branch = self.entry.get_text()
63
error_dialog(_('Branch not given'),
64
_('Please specify a branch to merge from.'))
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.'))
75
conflicts = self.wt.merge_from_branch(other_branch)
76
except errors.BzrCommandError, errmsg:
77
error_dialog(_('Bazaar command error'), str(errmsg))
83
info_dialog(_('Merge successful'),
84
_('All changes applied successfully.'))
86
# There are conflicts to be resolved.
87
warning_dialog(_('Conflicts encountered'),
88
_('Please resolve the conflicts manually before committing.'))
59
90
def open(self, widget):
60
print "DEBUG: Open branch button pressed."
91
fcd = gtk.FileChooserDialog(title="Please select a folder",
93
action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
94
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
95
gtk.STOCK_OPEN, gtk.RESPONSE_OK))
96
fcd.set_default_response(gtk.RESPONSE_OK)
98
if fcd.run() == gtk.RESPONSE_OK:
99
self.entry.set_text(fcd.get_filename())
62
103
def close(self, widget=None):
63
104
self.window.destroy()