[Pkg-bazaar-commits] ./bzr-gtk/unstable r108: Merge from trunk.

Szilveszter Farkas (Phanatic) Szilveszter.Farkas at gmail.com
Fri Apr 10 07:45:43 UTC 2009


------------------------------------------------------------
revno: 108
committer: Szilveszter Farkas (Phanatic) <Szilveszter.Farkas at gmail.com>
branch nick: bzr-gtk
timestamp: Fri 2006-11-03 20:02:39 +0100
message:
  Merge from trunk.
modified:
  __init__.py
  olive/__init__.py
  olive/commit.py
  setup.py
    ------------------------------------------------------------
    revno: 91.1.10
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trunk
    timestamp: Thu 2006-11-02 23:51:33 +0100
    message:
      Fix name for bzr-gtk (closes: #67933), update version number.
    modified:
      setup.py
    ------------------------------------------------------------
    revno: 91.1.11
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trunk
    timestamp: Fri 2006-11-03 00:01:58 +0100
    message:
      Cherrypick Alexanders' fix for #68127.
    modified:
      __init__.py
      olive/__init__.py
      olive/commit.py
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py	2006-10-25 09:21:13 +0000
+++ b/__init__.py	2006-11-02 23:01:58 +0000
@@ -199,6 +199,7 @@
     takes_options = []
 
     def run(self, filename=None):
+        import os
         import pygtk
         pygtk.require("2.0")
 
@@ -210,14 +211,31 @@
 
         from olive.commit import CommitDialog
         from bzrlib.commit import Commit
-        from bzrlib.errors import (BzrCommandError, PointlessCommit, ConflictsInTree, 
-           StrictCommitFailed)
-
-        (wt, path) = WorkingTree.open_containing(filename)
-
-        dialog = CommitDialog(wt, path, standalone=True)
-        dialog.display()
-        gtk.main()
+        from bzrlib.errors import (BzrCommandError,
+                                   NotBranchError,
+                                   NoWorkingTree,
+                                   PointlessCommit,
+                                   ConflictsInTree,
+                                   StrictCommitFailed)
+
+        wt = None
+        branch = None
+        try:
+            (wt, path) = WorkingTree.open_containing(filename)
+            branch = wt.branch
+        except NotBranchError, e:
+            path = e.path
+        except NoWorkingTree, e:
+            path = e.base
+            try:
+                (branch, path) = Branch.open_containing(path)
+            except NotBranchError, e:
+                path = e.path
+
+        dialog = CommitDialog(wt, path, not branch)
+        if dialog.display():
+            dialog.window.connect("destroy", lambda w: gtk.main_quit())
+            gtk.main()
 
 register_command(cmd_gcommit)
 

=== modified file 'olive/__init__.py'
--- a/olive/__init__.py	2006-10-31 14:11:16 +0000
+++ b/olive/__init__.py	2006-11-02 23:01:58 +0000
@@ -223,7 +223,7 @@
     def on_menuitem_branch_commit_activate(self, widget):
         """ Branch/Commit... menu handler. """
         from commit import CommitDialog
-        commit = CommitDialog(self.wt, self.wtpath)
+        commit = CommitDialog(self.wt, self.wtpath, self.notbranch)
         commit.display()
     
     def on_menuitem_branch_merge_activate(self, widget):

=== modified file 'olive/commit.py'
--- a/olive/commit.py	2006-10-31 14:11:16 +0000
+++ b/olive/commit.py	2006-11-02 23:01:58 +0000
@@ -34,19 +34,18 @@
 
 class CommitDialog:
     """ Display Commit dialog and perform the needed actions. """
-    def __init__(self, wt, wtpath, standalone=False):
+    def __init__(self, wt, wtpath, notbranch):
         """ Initialize the Commit dialog.
         :param  wt:         bzr working tree object
         :param  wtpath:     path to working tree root
-        :param  standalone: when used in gcommit command as standalone window
-                            this argument should be True
+        :param  notbranch:  flag that path is not a brach
+        :type   notbranch:  bool
         """
         self.glade = gtk.glade.XML(GLADEFILENAME, 'window_commit', 'olive-gtk')
         
         self.wt = wt
         self.wtpath = wtpath
-
-        self.standalone = standalone
+        self.notbranch = notbranch
 
         # Get some important widgets
         self.window = self.glade.get_widget('window_commit')
@@ -56,11 +55,7 @@
         self.pending_label = self.glade.get_widget('label_commit_pending')
         self.pending_view = self.glade.get_widget('treeview_commit_pending')
 
-        file_id = self.wt.path2id(wtpath)
-
-        self.notbranch = False
-        if file_id is None:
-            self.notbranch = True
+        if wt is None or notbranch:
             return
         
         # Set the delta
@@ -74,10 +69,6 @@
         dic = { "on_button_commit_commit_clicked": self.commit,
                 "on_button_commit_cancel_clicked": self.close }
 
-        if self.standalone:
-            dic["on_button_commit_cancel_clicked"] = self.quit
-            self.window.connect("delete_event", gtk.main_quit)
-        
         # Connect the signals to the handlers
         self.glade.signal_autoconnect(dic)
         
@@ -87,11 +78,19 @@
         self._create_pending_merges()
     
     def display(self):
-        """ Display the Push dialog. """
+        """ Display the Push dialog.
+        @return:    True if dialog is shown.
+        """
+        if self.wt is None and not self.notbranch:
+            error_dialog(_('Directory does not have a working tree'),
+                         _('Operation aborted.'))
+            self.close()
+            return False
         if self.notbranch:
             error_dialog(_('Directory is not a branch'),
                          _('You can perform this action only in a branch.'))
             self.close()
+            return False
         else:
             if self.wt.branch.get_bound_location() is not None:
                 # we have a checkout, so the local commit checkbox must appear
@@ -106,7 +105,7 @@
             
             self.textview.modify_font(pango.FontDescription("Monospace"))
             self.window.show()
-            
+            return True
     
     def _create_file_view(self):
         self.file_store = gtk.ListStore(gobject.TYPE_BOOLEAN,   # [0] checkbox
@@ -298,14 +297,7 @@
             error_dialog(_('Unknown error'), str(msg))
             return
 
-        if not self.standalone:
-            self.close()
-        else:
-            self.quit()
-        
+        self.close()
+
     def close(self, widget=None):
         self.window.destroy()
-
-    def quit(self, widget=None):
-        self.close(widget)
-        gtk.main_quit()

=== modified file 'setup.py'
--- a/setup.py	2006-10-14 10:26:00 +0000
+++ b/setup.py	2006-11-02 22:51:33 +0000
@@ -48,8 +48,8 @@
 
 
 setup(
-    name = "gtk",
-    version = "0.11.0",
+    name = "bzr-gtk",
+    version = "0.12.0",
     maintainer = "Jelmer Vernooij",
     maintainer_email = "jelmer at samba.org",
     description = "GTK+ Frontends for various Bazaar commands",



More information about the Pkg-bazaar-commits mailing list