[Pkg-bazaar-commits] ./bzr-gtk/unstable r432: Misc updates

Aaron Bentley aaron at aaronbentley.com
Fri Apr 10 07:44:56 UTC 2009


------------------------------------------------------------
revno: 432
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: gtk-applymerge
timestamp: Sat 2008-02-23 02:26:04 -0500
message:
  Misc updates
modified:
  __init__.py
  diff.py
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py	2008-02-23 04:55:56 +0000
+++ b/__init__.py	2008-02-23 07:26:04 +0000
@@ -22,6 +22,7 @@
 gcommit           GTK+ commit dialog.
 gconflicts        GTK+ conflicts. 
 gdiff             Show differences in working tree in a GTK+ Window. 
+ghandle-patch     Display and optionally merge a merge directive or patch.
 ginit             Initialise a new branch.
 gmissing          GTK+ missing revisions dialog. 
 gpreferences      GTK+ preferences dialog. 
@@ -674,6 +675,12 @@
 
 
 class cmd_ghandle_patch(GTKCommand):
+    """Display a patch or merge directive, possibly merging.
+
+    This is a helper, meant to be launched from other programs like browsers
+    or email clients.  Since these programs often do not allow parameters to
+    be provided, a "handle-patch" script is included.
+    """
 
     takes_args = ['path']
 

=== modified file 'diff.py'
--- a/diff.py	2008-02-23 06:37:01 +0000
+++ b/diff.py	2008-02-23 07:26:04 +0000
@@ -45,6 +45,7 @@
 
 
 class DiffFileView(gtk.ScrolledWindow):
+    """Window for displaying diffs from a diff file"""
 
     def __init__(self):
         gtk.ScrolledWindow.__init__(self)
@@ -259,6 +260,7 @@
         self.parent_tree = None
 
     def show_diff(self, specific_files):
+        """Show the diff for the specified files"""
         s = StringIO()
         show_diff_trees(self.parent_tree, self.rev_tree, s, specific_files,
                         old_label='', new_label='',
@@ -313,6 +315,10 @@
         self.treeview.append_column(column)
 
     def set_diff_text(self, lines):
+        """Set the current diff from a list of lines
+
+        :param lines: The diff to show, in unified diff format
+        """
         # The diffs of the  selected file: a scrollable source or
         # text view
         self.diff_view = DiffFileView()
@@ -369,6 +375,7 @@
         self.treeview.expand_all()
 
     def set_file(self, file_path):
+        """Select the current file to display"""
         tv_path = None
         for data in self.model:
             for child in data.iterchildren():
@@ -426,9 +433,18 @@
         self.diff.show_all()
 
     def _get_button_bar(self):
+        """Return a button bar to use.
+
+        :return: None, meaning that no button bar will be used.
+        """
         return None
 
     def set_diff_text(self, description, lines):
+        """Set the diff from a text.
+
+        The diff must be in unified diff format, and will be parsed to
+        determine filenames.
+        """
         self.diff.set_diff_text(lines)
         self.set_title(description + " - bzrk diff")
 
@@ -453,6 +469,7 @@
         self.directive = directive
 
     def _get_button_bar(self):
+        """The button bar has only the Merge button"""
         merge_button = gtk.Button('Merge')
         merge_button.show()
         merge_button.set_relief(gtk.RELIEF_NONE)
@@ -503,13 +520,12 @@
                                            gtk.RESPONSE_CANCEL,))
         try:
             result = d.run()
-            if result == gtk.RESPONSE_OK:
-                uri = d.get_current_folder_uri()
-                return workingtree.WorkingTree.open(uri)
-            else:
+            if result != gtk.RESPONSE_OK:
                 raise SelectCancelled()
+            uri = d.get_current_folder_uri()
         finally:
             d.destroy()
+        return workingtree.WorkingTree.open(uri)
 
 
 def _iter_changes_to_status(source, target):



More information about the Pkg-bazaar-commits mailing list