[Pkg-bazaar-commits] ./bzr-gtk/unstable r581: Added gloom command to manage looms. (Jelmer Vernooij
Martin Albisetti
argentina at gmail.com
Fri Apr 10 07:50:46 UTC 2009
------------------------------------------------------------
revno: 581
committer: Martin Albisetti <argentina at gmail.com>
branch nick: gtk.dev
timestamp: Sat 2008-08-02 17:39:35 -0300
message:
Added gloom command to manage looms. (Jelmer Vernooij
added:
loom.py
modified:
NEWS
__init__.py
commit.py
------------------------------------------------------------
revno: 580.1.1
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Thu 2008-07-31 01:52:06 +0200
message:
Add gloom command.
added:
loom.py
modified:
__init__.py
------------------------------------------------------------
revno: 580.1.2
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Thu 2008-07-31 02:07:21 +0200
message:
Show threads in loom dialog.
modified:
commit.py
loom.py
------------------------------------------------------------
revno: 580.1.3
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Thu 2008-07-31 03:09:01 +0200
message:
Show diffs of threads, allow switching to different threads.
modified:
__init__.py
loom.py
------------------------------------------------------------
revno: 580.1.4
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Thu 2008-07-31 03:11:43 +0200
message:
Update FIXME, add news entry.
modified:
NEWS
loom.py
------------------------------------------------------------
revno: 580.1.5
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Thu 2008-07-31 03:51:56 +0200
message:
Try to import rather than use getattr to avoid problems wrt the order in which plugins are loaded.
modified:
__init__.py
------------------------------------------------------------
revno: 580.1.6
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Thu 2008-07-31 03:55:07 +0200
message:
Avoid making assumptions about a branch being a loom until we've checked.
modified:
loom.py
------------------------------------------------------------
revno: 580.2.1
committer: Martin Albisetti <argentina at gmail.com>
branch nick: gtk.gloom
timestamp: Sat 2008-08-02 17:38:35 -0300
message:
Merge gloom patch from Jelmer
added:
loom.py
modified:
NEWS
__init__.py
commit.py
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2008-07-27 12:01:40 +0000
+++ b/NEWS 2008-08-02 20:38:35 +0000
@@ -25,6 +25,8 @@
* Made merge dialog to give choice between folder and custom location (Jasper Groenewegen)
+ * Add new dialog to browse looms and switch to threads in loom branches. (Jelmer Vernooij)
+
BUG FIXES
* Replace _() calls by _i18n() calls. (Vincent Ladeuil, #187283)
=== modified file '__init__.py'
--- a/__init__.py 2008-07-25 22:29:51 +0000
+++ b/__init__.py 2008-07-31 01:51:56 +0000
@@ -22,6 +22,7 @@
gconflicts GTK+ conflicts.
gdiff Show differences in working tree in a GTK+ Window.
ginit Initialise a new branch.
+gloom GTK+ loom browse dialog
gmerge GTK+ merge dialog
gmissing GTK+ missing revisions dialog.
gpreferences GTK+ preferences dialog.
@@ -172,11 +173,29 @@
def run(self, location="."):
(br, path) = branch.Branch.open_containing(location)
open_display()
- from push import PushDialog
+ from bzrlib.plugins.gtk.push import PushDialog
dialog = PushDialog(br.repository, br.last_revision(), br)
dialog.run()
+class cmd_gloom(GTKCommand):
+ """ GTK+ loom.
+
+ """
+ takes_args = [ "location?" ]
+
+ def run(self, location="."):
+ try:
+ (tree, path) = workingtree.WorkingTree.open_containing(location)
+ br = tree.branch
+ except NoWorkingTree, e:
+ (br, path) = branch.Branch.open_containing(location)
+ tree = None
+ open_display()
+ from bzrlib.plugins.gtk.loom import LoomDialog
+ dialog = LoomDialog(br, tree)
+ dialog.run()
+
class cmd_gdiff(GTKCommand):
"""Show differences in working tree in a GTK+ Window.
@@ -548,6 +567,13 @@
cmd_visualise
]
+try:
+ from bzrlib.plugins import loom
+except ImportError:
+ pass # Loom plugin doesn't appear to be present
+else:
+ commands.append(cmd_gloom)
+
for cmd in commands:
register_command(cmd)
=== modified file 'commit.py'
--- a/commit.py 2008-07-27 07:59:23 +0000
+++ b/commit.py 2008-07-31 00:07:21 +0000
@@ -101,7 +101,7 @@
"""Implementation of Commit."""
def __init__(self, wt, selected=None, parent=None):
- gtk.Dialog.__init__(self, title="Commit - Olive",
+ gtk.Dialog.__init__(self, title="Commit",
parent=parent,
flags=0,
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
=== added file 'loom.py'
--- a/loom.py 1970-01-01 00:00:00 +0000
+++ b/loom.py 2008-07-31 01:55:07 +0000
@@ -0,0 +1,122 @@
+# Copyright (C) 2008 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
+
+try:
+ import pygtk
+ pygtk.require("2.0")
+except:
+ pass
+
+import gtk
+import gobject
+
+from bzrlib.plugins.gtk import _i18n
+from bzrlib.plugins.gtk.diff import DiffWidget
+from bzrlib.plugins.gtk.dialog import question_dialog
+from bzrlib.plugins.loom import branch as loom_branch
+from bzrlib.plugins.loom import tree as loom_tree
+
+class LoomDialog(gtk.Dialog):
+ """Simple Loom browse dialog."""
+
+ def __init__(self, branch, tree=None, parent=None):
+ gtk.Dialog.__init__(self, title="Threads",
+ parent=parent,
+ flags=0,
+ buttons=(gtk.STOCK_CLOSE,gtk.RESPONSE_OK))
+ self.branch = branch
+ if tree is not None:
+ self.tree = loom_tree.LoomTreeDecorator(tree)
+ else:
+ self.tree = None
+
+ self._construct()
+
+ def run(self):
+ try:
+ loom_branch.require_loom_branch(self.branch)
+ except loom_branch.NotALoom:
+ response = question_dialog(
+ _i18n("Upgrade to Loom branch?"),
+ _i18n("Branch is not a loom branch. Upgrade to Loom format?"),
+ parent=self)
+ # Doesn't set a parent for the dialog..
+ if response == gtk.RESPONSE_NO:
+ return
+ assert self.branch.nick is not None
+ loom_branch.loomify(self.branch)
+ self._load_threads()
+ return super(LoomDialog, self).run()
+
+ def _construct(self):
+ hbox = gtk.HBox()
+
+ self._threads_scroller = gtk.ScrolledWindow()
+ self._threads_scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+ self._threads_view = gtk.TreeView()
+ self._threads_scroller.add(self._threads_view)
+ self._threads_scroller.set_shadow_type(gtk.SHADOW_IN)
+ hbox.pack_start(self._threads_scroller)
+
+ self._threads_store = gtk.ListStore(
+ gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_PYOBJECT, gobject.TYPE_STRING)
+ self._threads_view.set_model(self._threads_store)
+ self._threads_view.append_column(gtk.TreeViewColumn("Name", gtk.CellRendererText(), text=0))
+ self._threads_view.connect('cursor-changed', self._on_view_thread)
+ if self.tree is not None:
+ self._threads_view.connect('row-activated', self._on_switch_thread)
+
+ self._diff = DiffWidget()
+ self._diff.show()
+ hbox.pack_end(self._diff)
+
+ hbox.show_all()
+ self.vbox.pack_start(hbox)
+
+ # FIXME: Buttons: combine-thread, revert-loom, record
+ self.set_default_size(500, 350)
+
+ def _on_view_thread(self, treeview):
+ treeselection = treeview.get_selection()
+ (model, selection) = treeselection.get_selected()
+ if selection is None:
+ return
+ revid, parent_revid = model.get(selection, 1, 3)
+ if parent_revid is None:
+ return
+ self.branch.lock_read()
+ try:
+ (rev_tree, parent_tree) = tuple(self.branch.repository.revision_trees([revid, parent_revid]))
+ self._diff.set_diff(rev_tree, parent_tree)
+ finally:
+ self.branch.unlock()
+
+ def _on_switch_thread(self, treeview, path, view_column):
+ new_thread = self._threads_store.get_value(self._threads_store.get_iter(path), 0)
+ self.tree.down_thread(new_thread)
+
+ def _load_threads(self):
+ self._threads_store.clear()
+
+ self.branch.lock_read()
+ try:
+ threads = self.branch.get_loom_state().get_threads()
+ last_revid = None
+ for name, revid, parent_ids in reversed(threads):
+ self._threads_store.append([name, revid, parent_ids, last_revid])
+ last_revid = revid
+ finally:
+ self.branch.unlock()
More information about the Pkg-bazaar-commits
mailing list