1
# Copyright (C) 2007 by Jelmer Vernooij <jelmer@samba.org>
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27
from bzrlib.plugins.gtk.branchbox import BranchSelectionBox
29
class CreateMergeDirectiveDialog(gtk.Dialog):
30
def __init__(self, branch, stop_revid=None):
31
super(CreateMergeDirectiveDialog, self).__init__()
33
self.stop_revid = stop_revid
37
# TODO: Create a frame with information about the revision that will be
40
# TODO: Create a frame with a the ability to select a branch
42
# TODO: Create a frame with a button for selecting a file name
47
class SendMergeDirectiveDialog(gtk.Dialog):
48
def __init__(self, branch, parent=None):
49
super(SendMergeDirectiveDialog, self).__init__(parent)
51
self.set_title("Send Merge Directive")
55
table = gtk.Table(rows=3, columns=2)
59
label.set_markup("<b>Branch to Submit:</b>")
60
table.attach(label, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
62
label = gtk.Label(str(self.branch))
63
table.attach(label, 1, 2, 0, 1, gtk.FILL, gtk.FILL)
66
label.set_markup("<b>Target Branch:</b>")
67
table.attach(label, 0, 1, 1, 2, gtk.FILL, gtk.FILL)
69
self.submit_branch = BranchSelectionBox(self.branch.get_submit_branch())
70
table.attach(self.submit_branch, 1, 2, 1, 2, gtk.FILL, gtk.FILL)
72
# TODO: Display number of revisions to be send whenever
73
# submit branch changes
76
label.set_markup("<b>Email To:</b>")
77
table.attach(label, 0, 1, 2, 3, gtk.FILL, gtk.FILL)
79
self.mail_to = gtk.ComboBoxEntry()
80
mail_to = self.branch.get_config().get_user_option('submit_to')
82
submit_branch = self.submit_branch.get_branch()
83
if submit_branch is not None:
84
mail_to = submit_branch.get_config().get_user_option(
86
if mail_to is not None:
87
self.mail_to.get_child().set_text(mail_to)
88
table.attach(self.mail_to, 1, 2, 2, 3, gtk.FILL, gtk.FILL)
90
self.add_buttons(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
91
gtk.STOCK_OK, gtk.RESPONSE_OK)
95
def get_mail_to(self):
96
return self.mail_to.get_child().get_text()
98
def get_merge_directive(self):
99
from bzrlib.merge_directive import MergeDirective2
100
from bzrlib import osutils
102
return MergeDirective2.from_objects(self.branch.repository,
103
self.branch.last_revision(),
105
osutils.local_time_offset(),
106
self.submit_branch.get_url(),
111
base_revision_id=None)
115
class ApplyMergeDirectiveDialog(gtk.Dialog):
117
super(ApplyMergeDirectiveDialog, self).__init__()