Rev 324: Add very simple "Send Merge Directive" window. in file:///data/jelmer/bzr-gtk/gsend/
Jelmer Vernooij
jelmer at samba.org
Fri Oct 26 18:02:19 BST 2007
At file:///data/jelmer/bzr-gtk/gsend/
------------------------------------------------------------
revno: 324
revision-id:jelmer at samba.org-20071026170218-pepec3wazqr3ghhb
parent: jelmer at samba.org-20071026162504-fywdnhnhitl5tlir
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: gsend
timestamp: Fr 2007-10-26 19:02:18 +0200
message:
Add very simple "Send Merge Directive" window.
modified:
__init__.py __init__.py-20060519165329-a1fd52c8a829fcd5
mergedirective.py mergedirective.py-20070805005518-41uc6l5dle4e2trw-1
=== modified file '__init__.py'
--- a/__init__.py 2007-10-26 16:25:04 +0000
+++ b/__init__.py 2007-10-26 17:02:18 +0000
@@ -389,9 +389,18 @@
"""
def run(self):
(br, path) = branch.Branch.open_containing(".")
+ gtk = self.open_display()
from bzrlib.plugins.gtk.mergedirective import SendMergeDirectiveDialog
+ from StringIO import StringIO
dialog = SendMergeDirectiveDialog(br)
- dialog.run()
+ if dialog.run() == gtk.RESPONSE_OK:
+ outf = StringIO()
+ outf.writelines(dialog.get_merge_directive().to_lines())
+ mail_client = br.get_config().get_mail_client()
+ mail_client.compose_merge_request(dialog.get_mail_to(), "[MERGE]",
+ outf.getvalue())
+
+
class cmd_gconflicts(GTKCommand):
=== modified file 'mergedirective.py'
--- a/mergedirective.py 2007-10-26 16:25:04 +0000
+++ b/mergedirective.py 2007-10-26 17:02:18 +0000
@@ -24,6 +24,8 @@
import gtk
import os
+from bzrlib.plugins.gtk.branchbox import BranchSelectionBox
+
class CreateMergeDirectiveDialog(gtk.Dialog):
def __init__(self, branch, stop_revid=None):
super(CreateMergeDirectiveDialog, self).__init__()
@@ -43,14 +45,66 @@
class SendMergeDirectiveDialog(gtk.Dialog):
- def __init__(self, branch):
- super(SendMergeDirectiveDialog, self).__init__()
+ def __init__(self, branch, parent=None):
+ super(SendMergeDirectiveDialog, self).__init__(parent)
self.branch = branch
+ self.set_title("Send Merge Directive")
self._create()
def _create(self):
- # FIXME: Add field for submit branch
- # FIXME: add field for send to address
+ table = gtk.Table(rows=3, columns=2)
+ self.vbox.add(table)
+
+ label = gtk.Label()
+ label.set_markup("<b>Branch to Submit:</b>")
+ table.attach(label, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
+
+ label = gtk.Label(str(self.branch))
+ table.attach(label, 1, 2, 0, 1, gtk.FILL, gtk.FILL)
+
+ label = gtk.Label()
+ label.set_markup("<b>Target Branch:</b>")
+ table.attach(label, 0, 1, 1, 2, gtk.FILL, gtk.FILL)
+
+ self.submit_branch = BranchSelectionBox(self.branch.get_submit_branch())
+ table.attach(self.submit_branch, 1, 2, 1, 2, gtk.FILL, gtk.FILL)
+
+ # TODO: Display number of revisions to be send whenever
+ # submit branch changes
+
+ label = gtk.Label()
+ label.set_markup("<b>Email To:</b>")
+ table.attach(label, 0, 1, 2, 3, gtk.FILL, gtk.FILL)
+
+ self.mail_to = gtk.ComboBoxEntry()
+ mail_to = self.branch.get_config().get_user_option('submit_to')
+ if mail_to is not None:
+ self.mail_to.get_child().set_text(mail_to)
+ table.attach(self.mail_to, 1, 2, 2, 3, gtk.FILL, gtk.FILL)
+
+ self.add_buttons(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
+ gtk.STOCK_OK, gtk.RESPONSE_OK)
+
+ self.show_all()
+
+ def get_mail_to(self):
+ return self.mail_to.get_child().get_text()
+
+ def get_merge_directive(self):
+ from bzrlib.merge_directive import MergeDirective2
+ from bzrlib import osutils
+ import time
+ return MergeDirective2.from_objects(self.branch.repository,
+ self.branch.last_revision(),
+ time.time(),
+ osutils.local_time_offset(),
+ self.submit_branch.get_url(),
+ public_branch=None,
+ include_patch=True,
+ include_bundle=True,
+ message=None,
+ base_revision_id=None)
+
class ApplyMergeDirectiveDialog(gtk.Dialog):
More information about the bazaar-commits
mailing list