[Pkg-bazaar-commits] ./bzr-gtk/unstable r427: Add merge button when displaying merge directives
Aaron Bentley
aaron at aaronbentley.com
Fri Apr 10 07:50:16 UTC 2009
------------------------------------------------------------
revno: 427
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: bzr-gtk-meld
timestamp: Tue 2008-01-15 00:34:43 -0500
message:
Add merge button when displaying merge directives
modified:
__init__.py
diff.py
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py 2008-01-14 05:12:30 +0000
+++ b/__init__.py 2008-01-15 05:34:43 +0000
@@ -678,14 +678,15 @@
takes_args = ['path']
def run(self, path):
- from bzrlib.plugins.gtk.diff import DiffWindow
- window = DiffWindow()
+ from bzrlib.plugins.gtk.diff import DiffWindow, MergeDirectiveWindow
lines = open(path, 'rb').readlines()
try:
directive = merge_directive.MergeDirective.from_lines(lines)
except errors.NotAMergeDirective:
+ window = DiffWindow()
window.set_diff_text(path, lines)
else:
+ window = MergeDirectiveWindow()
window.set_diff_text(path, directive.patch.splitlines(True))
window.show()
gtk = self.open_display()
=== modified file 'diff.py'
--- a/diff.py 2008-01-14 05:12:30 +0000
+++ b/diff.py 2008-01-15 05:34:43 +0000
@@ -298,13 +298,22 @@
self.construct()
+ def _get_button_bar(self):
+ return None
+
def construct(self):
"""Construct the window contents."""
# The window consists of a pane containing: the
# hierarchical list of files on the left, and the diff
# for the currently selected file on the right.
+ self.vbox = gtk.VBox()
+ self.add(self.vbox)
+ self.vbox.show()
self.pane = gtk.HPaned()
- self.add(self.pane)
+ self.vbox.pack_end(self.pane, expand=True, fill=True)
+ hbox = self._get_button_bar()
+ if hbox is not None:
+ self.vbox.pack_start(hbox, expand=False, fill=True)
self.pane.show()
# The file hierarchy: a scrollable treeview
@@ -342,7 +351,7 @@
newname = patch.newname.split('\t')[0]
self.model.append(None, [oldname, newname])
self.diff_view._diffs[newname] = str(patch)
-
+ self.diff_view.show_diff(None)
def set_diff(self, description, rev_tree, parent_tree):
"""Set the differences showed by this window.
@@ -387,6 +396,7 @@
self.treeview.expand_all()
self.set_title(description + " - bzrk diff")
+ self.diff_view.show_diff(None)
def set_file(self, file_path):
tv_path = None
@@ -412,6 +422,19 @@
self.diff_view.show_diff(specific_files)
+class MergeDirectiveWindow(DiffWindow):
+
+ def _get_button_bar(self):
+ merge_button = gtk.Button('Merge')
+ merge_button.show()
+ merge_button.set_relief(gtk.RELIEF_NONE)
+ hbox = gtk.HButtonBox()
+ hbox.set_layout(gtk.BUTTONBOX_START)
+ hbox.pack_start(merge_button, expand=False, fill=True)
+ hbox.show()
+ return hbox
+
+
def _iter_changes_to_status(source, target):
"""Determine the differences between trees.
More information about the Pkg-bazaar-commits
mailing list