[Pkg-bazaar-commits] ./bzr-gtk/unstable r190: Merge upstream
Jelmer Vernooij
jelmer at samba.org
Fri Apr 10 07:49:34 UTC 2009
------------------------------------------------------------
revno: 190
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Sat 2007-04-07 16:57:59 +0200
message:
Merge upstream
added:
initialize.py
modified:
NEWS
README
__init__.py
olive.glade
olive/__init__.py
------------------------------------------------------------
revno: 188.1.1
committer: Szilveszter Farkas (Phanatic) <Szilveszter.Farkas at gmail.com>
branch nick: bzr-gtk.90839
timestamp: Fri 2007-04-06 19:16:31 +0200
message:
Inital implementation of the Initialize dialog. Not fully functional yet.
added:
initialize.py
modified:
__init__.py
------------------------------------------------------------
revno: 188.1.2
committer: Szilveszter Farkas (Phanatic) <Szilveszter.Farkas at gmail.com>
branch nick: bzr-gtk.90839
timestamp: Fri 2007-04-06 19:48:23 +0200
message:
Implemented init functionality.
modified:
initialize.py
------------------------------------------------------------
revno: 188.1.3
committer: Szilveszter Farkas (Phanatic) <Szilveszter.Farkas at gmail.com>
branch nick: bzr-gtk.90839
timestamp: Fri 2007-04-06 19:59:23 +0200
message:
Added the new Initialize dialog to Olive.
modified:
olive.glade
olive/__init__.py
------------------------------------------------------------
revno: 188.1.4
committer: Szilveszter Farkas (Phanatic) <Szilveszter.Farkas at gmail.com>
branch nick: bzr-gtk.90839
timestamp: Fri 2007-04-06 20:11:55 +0200
message:
Added NEWS entry.
modified:
NEWS
------------------------------------------------------------
revno: 188.2.1
committer: Szilveszter Farkas (Phanatic) <Szilveszter.Farkas at gmail.com>
branch nick: trunk
timestamp: Sat 2007-04-07 09:43:25 +0200
message:
Merged fix for #90839. Initialize dialog implemented.
added:
initialize.py
modified:
NEWS
__init__.py
olive.glade
olive/__init__.py
------------------------------------------------------------
revno: 188.2.2
committer: Szilveszter Farkas (Phanatic) <Szilveszter.Farkas at gmail.com>
branch nick: trunk
timestamp: Sat 2007-04-07 15:40:59 +0200
message:
Added note about plugin directory name.
modified:
README
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2007-04-03 20:01:05 +0000
+++ b/NEWS 2007-04-07 07:43:25 +0000
@@ -1,12 +1,16 @@
0.16.0 UNRELEASED
+ FEATURES
+
+ * An Initialize dialog added to Olive along with a 'ginit' command
+ (#90839, Szilveszter)
0.15.2 2007-04-03
BUG FIXES
* Fix regression that prevented gannotate from being used (#97473,
- Vincent, Jelmer)
+ Vincent, Jelmer)
* Fix regression that prevented gstatus from being used (Jelmer)
=== modified file 'README'
--- a/README 2007-03-09 16:22:27 +0000
+++ b/README 2007-04-07 13:40:59 +0000
@@ -43,6 +43,8 @@
your bzr working tree, or adding the location of bzr-gtk to your
BZR_PLUGIN_PATH environment variable.
+Note: the plugin directory of bzr-gtk must be called 'gtk'.
+
To use the nautilus integration, either place the nautilus-bzr.py file in
~/.nautilus/python-extensions or in /usr/lib/nautilus/extensions-1.0/python
=== modified file '__init__.py'
--- a/__init__.py 2007-04-03 20:01:05 +0000
+++ b/__init__.py 2007-04-06 17:16:31 +0000
@@ -419,6 +419,14 @@
local_branch.unlock()
+class cmd_ginit(GTKCommand):
+ def run(self):
+ self.open_display()
+ from initialize import InitDialog
+ dialog = InitDialog(os.path.abspath(os.path.curdir))
+ dialog.run()
+
+
commands = [
cmd_gmissing,
cmd_gpreferences,
@@ -430,7 +438,8 @@
cmd_gdiff,
cmd_gpush,
cmd_gcheckout,
- cmd_gbranch
+ cmd_gbranch,
+ cmd_ginit
]
for cmd in commands:
=== added file 'initialize.py'
--- a/initialize.py 1970-01-01 00:00:00 +0000
+++ b/initialize.py 2007-04-06 17:48:23 +0000
@@ -0,0 +1,118 @@
+# Copyright (C) 2007 by Szilveszter Farkas (Phanatic) <szilveszter.farkas at gmail.com>
+#
+# 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
+
+try:
+ import pygtk
+ pygtk.require("2.0")
+except:
+ pass
+
+import gtk
+
+import os
+
+from dialog import error_dialog
+from errors import show_bzr_error
+
+from bzrlib import bzrdir
+from bzrlib import transport
+import bzrlib.errors as errors
+
+class InitDialog(gtk.Dialog):
+ """ Initialize dialog. """
+ def __init__(self, path, parent=None):
+ """ Initialize the Initialize dialog. """
+ gtk.Dialog.__init__(self, title="Initialize - Olive",
+ parent=parent,
+ flags=0,
+ buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
+
+ # Get arguments
+ self.path = path
+
+ # Create the widgets
+ self._button_init = gtk.Button(_("_Initialize"), use_underline=True)
+ self._label_question = gtk.Label(_("Which directory do you want to initialize?"))
+ self._radio_current = gtk.RadioButton(None, _("Current directory"))
+ self._radio_custom = gtk.RadioButton(self._radio_current, _("Create a new directory with the name:"))
+ self._entry_custom = gtk.Entry()
+ self._hbox_custom = gtk.HBox()
+
+ # Set callbacks
+ self._button_init.connect('clicked', self._on_init_clicked)
+ self._radio_custom.connect('toggled', self._on_custom_toggled)
+
+ # Set properties
+ self._entry_custom.set_sensitive(False)
+
+ # Construct the dialog
+ self.action_area.pack_end(self._button_init)
+
+ self._hbox_custom.pack_start(self._radio_custom, False, False)
+ self._hbox_custom.pack_start(self._entry_custom, True, True)
+
+ self.vbox.pack_start(self._label_question)
+ self.vbox.pack_start(self._radio_current)
+ self.vbox.pack_start(self._hbox_custom)
+
+ # Display the dialog
+ self.vbox.show_all()
+
+ def _on_custom_toggled(self, widget):
+ """ Occurs if the Custom radiobutton is toggled. """
+ if self._radio_custom.get_active():
+ self._entry_custom.set_sensitive(True)
+ self._entry_custom.grab_focus()
+ else:
+ self._entry_custom.set_sensitive(False)
+
+ @show_bzr_error
+ def _on_init_clicked(self, widget):
+ if self._radio_custom.get_active() and len(self._entry_custom.get_text()) == 0:
+ error_dialog(_("Directory name not specified"),
+ _("You should specify a new directory name."))
+ return
+
+ if self._radio_current.get_active():
+ location = self.path
+ else:
+ location = self.path + os.sep + self._entry_custom.get_text()
+
+ format = bzrdir.format_registry.make_bzrdir('default')
+ to_transport = transport.get_transport(location)
+
+ try:
+ to_transport.mkdir('.')
+ except errors.FileExists:
+ pass
+
+ try:
+ existing_bzrdir = bzrdir.BzrDir.open(location)
+ except errors.NotBranchError:
+ branch = bzrdir.BzrDir.create_branch_convenience(to_transport.base,
+ format=format)
+ else:
+ from bzrlib.transport.local import LocalTransport
+ if existing_bzrdir.has_branch():
+ if (isinstance(to_transport, LocalTransport)
+ and not existing_bzrdir.has_workingtree()):
+ raise errors.BranchExistsWithoutWorkingTree(location)
+ raise errors.AlreadyBranchError(location)
+ else:
+ branch = existing_bzrdir.create_branch()
+ existing_bzrdir.create_workingtree()
+
+ self.response(gtk.RESPONSE_OK)
=== modified file 'olive.glade'
--- a/olive.glade 2007-02-04 12:05:45 +0000
+++ b/olive.glade 2007-04-06 17:59:23 +0000
@@ -204,7 +204,7 @@
<child>
<widget class="GtkMenuItem" id="menuitem_branch_initialize">
<property name="visible">True</property>
- <property name="label" translatable="yes">_Initialize</property>
+ <property name="label" translatable="yes">_Initialize...</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_menuitem_branch_initialize_activate" last_modification_time="Mon, 17 Jul 2006 08:52:48 GMT"/>
</widget>
=== modified file 'olive/__init__.py'
--- a/olive/__init__.py 2007-03-15 16:54:15 +0000
+++ b/olive/__init__.py 2007-04-06 17:59:23 +0000
@@ -48,6 +48,7 @@
from bzrlib.plugins.gtk.annotate.config import GAnnotateConfig
from bzrlib.plugins.gtk.commit import CommitDialog
from bzrlib.plugins.gtk.conflicts import ConflictsDialog
+from bzrlib.plugins.gtk.initialize import InitDialog
from bzrlib.plugins.gtk.push import PushDialog
class OliveGtk:
@@ -343,30 +344,17 @@
status = StatusDialog(self.wt, self.wtpath)
status.display()
- @show_bzr_error
def on_menuitem_branch_initialize_activate(self, widget):
""" Initialize current directory. """
- import bzrlib.bzrdir as bzrdir
+ init = InitDialog(self.path, self.window)
+ response = init.run()
+ if response != gtk.RESPONSE_NONE:
+ init.hide()
- if not os.path.exists(self.path):
- os.mkdir(self.path)
-
- try:
- existing_bzrdir = bzrdir.BzrDir.open(self.path)
- except bzrerrors.NotBranchError:
- bzrdir.BzrDir.create_branch_convenience(self.path)
- else:
- if existing_bzrdir.has_branch():
- if existing_bzrdir.has_workingtree():
- raise bzrerrors.AlreadyBranchError(self.path)
- else:
- raise bzrerrors.BranchExistsWithoutWorkingTree(self.path)
- else:
- existing_bzrdir.create_branch()
- existing_bzrdir.create_workingtree()
- info_dialog(_('Initialize successful'),
- _('Directory successfully initialized.'))
- self.refresh_right()
+ if response == gtk.RESPONSE_OK:
+ self.refresh_right()
+
+ init.destroy()
def on_menuitem_file_annotate_activate(self, widget):
""" File/Annotate... menu handler. """
More information about the Pkg-bazaar-commits
mailing list