bzr branch
http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
254.1.1
by Jelmer Vernooij
Add Merge Directive option to revision menu. |
1 |
# Copyright (C) 2007 by Jelmer Vernooij <jelmer@samba.org>
|
2 |
#
|
|
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.
|
|
7 |
#
|
|
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.
|
|
12 |
#
|
|
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
|
|
16 |
||
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
17 |
from gi.repository import Gtk |
254.1.1
by Jelmer Vernooij
Add Merge Directive option to revision menu. |
18 |
|
324
by Jelmer Vernooij
Add very simple "Send Merge Directive" window. |
19 |
from bzrlib.plugins.gtk.branchbox import BranchSelectionBox |
20 |
||
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
21 |
class CreateMergeDirectiveDialog(Gtk.Dialog): |
254.1.1
by Jelmer Vernooij
Add Merge Directive option to revision menu. |
22 |
def __init__(self, branch, stop_revid=None): |
23 |
super(CreateMergeDirectiveDialog, self).__init__() |
|
24 |
self.branch = branch |
|
25 |
self.stop_revid = stop_revid |
|
26 |
self._create() |
|
27 |
||
28 |
def _create(self): |
|
29 |
# TODO: Create a frame with information about the revision that will be
|
|
30 |
# submittted
|
|
31 |
||
32 |
# TODO: Create a frame with a the ability to select a branch
|
|
724
by Jelmer Vernooij
Fix formatting, imports. |
33 |
|
254.1.1
by Jelmer Vernooij
Add Merge Directive option to revision menu. |
34 |
# TODO: Create a frame with a button for selecting a file name
|
35 |
# for the bundle
|
|
36 |
pass
|
|
37 |
||
38 |
||
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
39 |
class SendMergeDirectiveDialog(Gtk.Dialog): |
324
by Jelmer Vernooij
Add very simple "Send Merge Directive" window. |
40 |
def __init__(self, branch, parent=None): |
41 |
super(SendMergeDirectiveDialog, self).__init__(parent) |
|
323
by Jelmer Vernooij
Add gsend command. |
42 |
self.branch = branch |
324
by Jelmer Vernooij
Add very simple "Send Merge Directive" window. |
43 |
self.set_title("Send Merge Directive") |
323
by Jelmer Vernooij
Add gsend command. |
44 |
self._create() |
45 |
||
46 |
def _create(self): |
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
47 |
table = Gtk.Table(rows=3, columns=2) |
734.1.15
by Curtis Hovey
Updated ComboBoxEntry -> Gtk.ComboBox.new_with_entry. |
48 |
self.get_content_area().add(table) |
324
by Jelmer Vernooij
Add very simple "Send Merge Directive" window. |
49 |
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
50 |
label = Gtk.Label() |
324
by Jelmer Vernooij
Add very simple "Send Merge Directive" window. |
51 |
label.set_markup("<b>Branch to Submit:</b>") |
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
52 |
table.attach(label, 0, 1, 0, 1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL) |
53 |
||
54 |
label = Gtk.Label(label=str(self.branch)) |
|
55 |
table.attach(label, 1, 2, 0, 1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL) |
|
56 |
||
57 |
label = Gtk.Label() |
|
324
by Jelmer Vernooij
Add very simple "Send Merge Directive" window. |
58 |
label.set_markup("<b>Target Branch:</b>") |
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
59 |
table.attach(label, 0, 1, 1, 2, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL) |
324
by Jelmer Vernooij
Add very simple "Send Merge Directive" window. |
60 |
|
61 |
self.submit_branch = BranchSelectionBox(self.branch.get_submit_branch()) |
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
62 |
table.attach(self.submit_branch, 1, 2, 1, 2, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL) |
324
by Jelmer Vernooij
Add very simple "Send Merge Directive" window. |
63 |
|
759
by Jelmer Vernooij
Extend branch preferences, show location widget. |
64 |
# TODO: Display number of revisions to be sent whenever
|
324
by Jelmer Vernooij
Add very simple "Send Merge Directive" window. |
65 |
# submit branch changes
|
66 |
||
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
67 |
label = Gtk.Label() |
324
by Jelmer Vernooij
Add very simple "Send Merge Directive" window. |
68 |
label.set_markup("<b>Email To:</b>") |
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
69 |
table.attach(label, 0, 1, 2, 3, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL) |
324
by Jelmer Vernooij
Add very simple "Send Merge Directive" window. |
70 |
|
734.1.15
by Curtis Hovey
Updated ComboBoxEntry -> Gtk.ComboBox.new_with_entry. |
71 |
self.mail_to = Gtk.ComboBox.new_with_entry() |
324
by Jelmer Vernooij
Add very simple "Send Merge Directive" window. |
72 |
mail_to = self.branch.get_config().get_user_option('submit_to') |
449.1.2
by Jelmer Vernooij
Honor child_submit_to in the submit_branch if no email address was specified. |
73 |
if mail_to is None: |
74 |
submit_branch = self.submit_branch.get_branch() |
|
75 |
if submit_branch is not None: |
|
76 |
mail_to = submit_branch.get_config().get_user_option( |
|
77 |
'child_submit_to') |
|
324
by Jelmer Vernooij
Add very simple "Send Merge Directive" window. |
78 |
if mail_to is not None: |
79 |
self.mail_to.get_child().set_text(mail_to) |
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
80 |
table.attach(self.mail_to, 1, 2, 2, 3, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL) |
324
by Jelmer Vernooij
Add very simple "Send Merge Directive" window. |
81 |
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
82 |
self.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, |
83 |
Gtk.STOCK_OK, Gtk.ResponseType.OK) |
|
324
by Jelmer Vernooij
Add very simple "Send Merge Directive" window. |
84 |
|
85 |
self.show_all() |
|
86 |
||
87 |
def get_mail_to(self): |
|
88 |
return self.mail_to.get_child().get_text() |
|
89 |
||
90 |
def get_merge_directive(self): |
|
91 |
from bzrlib.merge_directive import MergeDirective2 |
|
92 |
from bzrlib import osutils |
|
93 |
import time |
|
94 |
return MergeDirective2.from_objects(self.branch.repository, |
|
95 |
self.branch.last_revision(), |
|
96 |
time.time(), |
|
97 |
osutils.local_time_offset(), |
|
98 |
self.submit_branch.get_url(), |
|
99 |
public_branch=None, |
|
100 |
include_patch=True, |
|
101 |
include_bundle=True, |
|
102 |
message=None, |
|
103 |
base_revision_id=None) |
|
104 |
||
254.1.1
by Jelmer Vernooij
Add Merge Directive option to revision menu. |
105 |
|
106 |
||
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
107 |
class ApplyMergeDirectiveDialog(Gtk.Dialog): |
254.1.1
by Jelmer Vernooij
Add Merge Directive option to revision menu. |
108 |
def __init__(self): |
109 |
super(ApplyMergeDirectiveDialog, self).__init__() |