[Pkg-bazaar-commits] ./bzr-gtk/unstable r90: Use Olive's clone dialog in nautilus-bzr; remove the old Clone dialog

Jelmer Vernooij jelmer at samba.org
Fri Apr 10 07:45:51 UTC 2009


------------------------------------------------------------
revno: 90
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: bzr-gtk
timestamp: Sun 2006-10-08 22:51:52 +0200
message:
  Use Olive's clone dialog in nautilus-bzr; remove the old Clone dialog 
  from BzrGtk.
removed:
  clone.py
  commit.py
modified:
  TODO
  __init__.py
  nautilus-bzr.py
-------------- next part --------------
=== modified file 'TODO'
--- a/TODO	2006-10-03 17:08:31 +0000
+++ b/TODO	2006-10-08 20:51:52 +0000
@@ -22,3 +22,4 @@
 - Is there any reason why on win32 bzr branches have to be on fixed drives and 
   not on, e.g., cdroms?
 - Add a 'merge' window, allowing merges from other branches.
+- Show list of pending merges in the commit window

=== modified file '__init__.py'
--- a/__init__.py	2006-09-29 19:58:36 +0000
+++ b/__init__.py	2006-10-08 20:51:52 +0000
@@ -38,12 +38,10 @@
             if str(e) == "could not open display":
                 raise NoDisplayError
 
-        from clone import CloneDialog
+        from bzrlib.plugins.gtk.olive.branch import BranchDialog
 
-        window = CloneDialog()
-        if window.run() == gtk.RESPONSE_OK:
-            bzrdir = BzrDir.open(window.url)
-            bzrdir.sprout(window.dest_path)
+        window = BranchDialog('.')
+        window.display()
 
 register_command(cmd_gbranch)
 
@@ -210,24 +208,16 @@
             if str(e) == "could not open display":
                 raise NoDisplayError
 
-        from commit import GCommitDialog
+        from olive.commit import CommitDialog
         from bzrlib.commit import Commit
         from bzrlib.errors import (BzrCommandError, PointlessCommit, ConflictsInTree, 
            StrictCommitFailed)
 
         (wt, path) = WorkingTree.open_containing(filename)
-        branch = wt.branch
-
-        file_id = wt.path2id(path)
-
-        if file_id is None:
-            raise NotVersionedError(filename)
-
-        dialog = GCommitDialog(wt)
-        dialog.set_title(path + " - Commit")
-        if dialog.run() != gtk.RESPONSE_CANCEL:
-            Commit().commit(working_tree=wt,message=dialog.message,
-                specific_files=dialog.specific_files)
+
+        dialog = CommitDialog(wt, path)
+        dialog.display()
+        gtk.main()
 
 register_command(cmd_gcommit)
 

=== removed file 'clone.py'
--- a/clone.py	2006-05-20 19:47:46 +0000
+++ b/clone.py	1970-01-01 00:00:00 +0000
@@ -1,79 +0,0 @@
-# Copyright (C) 2006 Jelmer Vernooij <jelmer at samba.org>
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-import pygtk
-pygtk.require("2.0")
-import gobject
-import gtk
-import pango
-from bzrlib.delta import compare_trees
-
-#FIXME: Allow specifying stop_revision
-#FIXME: Allow specifying target branch format
-#FIXME: Implement _Browse callback
-
-class CloneDialog(gtk.Dialog):
-    """ Branch (clone) Dialog """
-
-    def __init__(self, dest_path=None):
-        gtk.Dialog.__init__(self)
-
-        self.set_default_size(400, 200)
-
-        self._create()
-
-        if dest_path:
-            self.url_entry.set_text(dest_path)
-
-    def _get_url(self):
-        return self.url_entry.get_text()
-
-    def _get_dest_path(self):
-        return self.path_entry.get_text()
-
-    dest_path = property(_get_dest_path)
-    url = property(_get_url)
-
-    def _browse_cb(self, *args):
-        #FIXME
-        pass
-
-    def _create(self):
-        frame = gtk.Frame(label="Branch URL")
-        self.vbox.pack_start(frame, fill=True)
-        self.url_entry = gtk.Entry()
-        frame.add(self.url_entry)
-        frame.show_all()
-
-        frame = gtk.Frame(label="Destination Path")
-        self.vbox.pack_start(frame, fill=True)
-        hbox = gtk.HBox()
-        self.path_entry = gtk.Entry()
-        hbox.add(self.path_entry)
-        hbox.add(gtk.Button(label="_Browse"))
-        frame.add(hbox)
-        frame.show_all()
-
-        frame = gtk.Frame(label="Options")
-        self.vbox.pack_start(frame)
-        vbox = gtk.VBox()
-        self.lightweight_button = gtk.CheckButton(label="Lightweight")
-        vbox.add(self.lightweight_button)
-        frame.add(vbox)
-        frame.show_all()
-
-        self.add_buttons(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, "_Get", gtk.RESPONSE_OK)
-                         

=== removed file 'commit.py'
--- a/commit.py	2006-08-30 11:25:53 +0000
+++ b/commit.py	1970-01-01 00:00:00 +0000
@@ -1,117 +0,0 @@
-# Copyright (C) 2006 Jelmer Vernooij <jelmer at samba.org>
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-import pygtk
-pygtk.require("2.0")
-import gobject
-import gtk
-import pango
-
-import bzrlib
-
-class GCommitDialog(gtk.Dialog):
-    """ Commit Dialog """
-
-    def __init__(self, tree):
-        gtk.Dialog.__init__(self)
-
-        self.set_default_size(400, 400)
-
-        self.old_tree = tree.branch.repository.revision_tree(tree.branch.last_revision())
-        self.pending_merges = tree.pending_merges()
-        self.delta = tree.changes_from(self.old_tree)
-
-        self._create()
-
-    def _create_file_view(self):
-        self.file_store = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_STRING)
-        self.file_view = gtk.TreeView(self.file_store)
-        crt = gtk.CellRendererToggle()
-        crt.set_property("activatable", True)
-        crt.connect("toggled", self._toggle_commit, self.file_store)
-        self.file_view.append_column(gtk.TreeViewColumn("Commit", 
-                                     crt, active=0))
-        self.file_view.append_column(gtk.TreeViewColumn("Path", 
-                                     gtk.CellRendererText(), text=1))
-        self.file_view.append_column(gtk.TreeViewColumn("Type", 
-                                     gtk.CellRendererText(), text=2))
-
-        for path, _, _ in self.delta.added:
-            self.file_store.append([ True, path, "Added" ])
-
-        for path, _, _ in self.delta.removed:
-            self.file_store.append([ True, path, "Removed" ])
-
-        for oldpath, _, _, _, _, _ in self.delta.renamed:
-            self.file_store.append([ True, oldpath, "Renamed"])
-
-        for path, _, _, _, _ in self.delta.modified:
-            self.file_store.append([ True, path, "Modified"])
-
-        self.file_view.show()
-
-    def _toggle_commit(self, cell, path, model):
-        model[path][0] = not model[path][0]
-        return
-    
-    def _get_specific_files(self):
-        ret = []
-        it = self.file_store.get_iter_first()
-        while it:
-            if self.file_store.get_value(it, 0):
-                ret.append(self.file_store.get_value(it, 1))
-            it = self.file_store.iter_next(it)
-
-        return ret
-
-    specific_files = property(_get_specific_files)
-
-    def _create_pending_merge_view(self, merges):
-        self.pending_merge_store = gtk.ListStore(gobject.TYPE_STRING)
-        for revid in merges:
-            self.pending_merge_store.append([revid])
-        self.pending_merge_view = gtk.TreeView(self.pending_merge_store)
-        self.pending_merge_view.show()
-
-    def _create_message_box(self):
-        self.message_entry = gtk.TextView()
-        self.message_entry.show()
-        return self.message_entry
-
-    def _get_message(self):
-        buffer = self.message_entry.get_buffer()
-        return buffer.get_text(buffer.get_start_iter(), buffer.get_end_iter())
-
-    message = property(_get_message)
-
-    def _create(self):
-        # Show list of changed files with checkboxes
-        self._create_file_view()
-        self.vbox.set_spacing(2)
-        self.vbox.pack_start(self.file_view, expand=True, fill=True)
-
-        # If_ there are any pending merges, show list of pending merges
-        if self.pending_merges:
-            self._create_pending_merge_view(self.pending_merges)
-            self.vbox.pack_start(self.pending_merge_view, expand=True, fill=True)
-
-        # Show box where user can add comments
-        self._create_message_box()
-        self.vbox.pack_start(self.message_entry, expand=True, fill=True)
-
-        # Commit, Cancel buttons
-        self.add_buttons(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, "_Commit", gtk.RESPONSE_OK)
-                         

=== modified file 'nautilus-bzr.py'
--- a/nautilus-bzr.py	2006-10-03 17:09:52 +0000
+++ b/nautilus-bzr.py	2006-10-08 20:51:52 +0000
@@ -118,17 +118,10 @@
         if vfs_file.get_uri_scheme() != 'file':
             return
 
-        file = vfs_file.get_uri()
-        try:
-            tree, path = WorkingTree.open_containing(file)
-        except NotBranchError:
-            return
-
-        from bzrlib.plugins.gtk.clone import CloneDialog
-        dialog = CloneDialog(file)
-        if dialog.run() != gtk.RESPONSE_CANCEL:
-            bzrdir = BzrDir.open(dialog.url)
-            bzrdir.sprout(dialog.dest_path)
+        from bzrlib.plugins.gtk.olive.branch import BranchDialog
+        
+        dialog = BranchDialog(vfs_file.get_name())
+        dialog.display()
  
     def commit_cb(self, menu, vfs_file=None):
         # We can only cope with local files
@@ -141,12 +134,10 @@
         except NotBranchError:
             return
 
-        from bzrlib.plugins.gtk.commit import GCommitDialog
-        dialog = GCommitDialog(tree)
-        dialog.set_title(path + " - Commit")
-        if dialog.run() != gtk.RESPONSE_CANCEL:
-            Commit().commit(working_tree=wt,message=dialog.message,
-                            specific_files=dialog.specific_files)
+        from bzrlib.plugins.gtk.olive.commit import CommitDialog
+        dialog = CommitDialog(tree, path)
+        dialog.display()
+        gtk.main()
 
     def log_cb(self, menu, vfs_file):
         # We can only cope with local files
@@ -167,6 +158,7 @@
         return
 
     def get_background_items(self, window, vfs_file):
+        items = []
         file = vfs_file.get_uri()
         try:
             tree, path = WorkingTree.open_containing(file)
@@ -185,7 +177,6 @@
 
             return items
 
-        items = []
         item = nautilus.MenuItem('BzrNautilus::log',
                              'Log',
                              'Show Bazaar history')



More information about the Pkg-bazaar-commits mailing list