Rev 534: Ask user whether to index if there is no index present yet. in file:///data/jelmer/bzr-gtk/trunk/
Jelmer Vernooij
jelmer at samba.org
Thu Jul 17 13:30:41 BST 2008
At file:///data/jelmer/bzr-gtk/trunk/
------------------------------------------------------------
revno: 534
revision-id: jelmer at samba.org-20080717123039-rnpqwdwtwp2uz8br
parent: jelmer at samba.org-20080717115103-djh5sb0pvpse2zkb
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Thu 2008-07-17 14:30:39 +0200
message:
Ask user whether to index if there is no index present yet.
modified:
search.py search.py-20080701140205-dvpvrtf7n1qp2t8a-1
viz/branchwin.py branchwin.py-20051016222514-15fd120652fcf25c
=== modified file 'search.py'
--- a/search.py 2008-07-01 15:28:30 +0000
+++ b/search.py 2008-07-17 12:30:39 +0000
@@ -26,7 +26,7 @@
class SearchDialog(gtk.Dialog):
"""Search dialog."""
- def __init__(self, branch, parent=None):
+ def __init__(self, index, parent=None):
gtk.Dialog.__init__(self, title="Search Revisions",
parent=parent,
flags=gtk.DIALOG_MODAL,
@@ -34,9 +34,7 @@
gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
# Get arguments
- self.branch = branch
-
- self.index = _mod_index.open_index_url(branch.base)
+ self.index = index
self.searchbar = gtk.HBox()
self.searchentry = gtk.Entry()
=== modified file 'viz/branchwin.py'
--- a/viz/branchwin.py 2008-07-01 21:54:21 +0000
+++ b/viz/branchwin.py 2008-07-17 12:30:39 +0000
@@ -420,8 +420,23 @@
_mod_index.index_url(self.branch.base)
def _branch_search_cb(self, w):
+ from bzrlib.plugins.search import index as _mod_index
from bzrlib.plugins.gtk.search import SearchDialog
- dialog = SearchDialog(self.branch)
+ from bzrlib.plugins.search import errors as search_errors
+
+ try:
+ index = _mod_index.open_index_url(self.branch.base)
+ except search_errors.NoSearchIndex:
+ dialog = gtk.MessageDialog(self, type=gtk.MESSAGE_QUESTION,
+ buttons=gtk.BUTTONS_OK_CANCEL,
+ message_format="This branch has not been indexed yet. "
+ "Index now?")
+ if dialog.run() == gtk.RESPONSE_OK:
+ index = _mod_index.index_url(self.branch.base)
+ else:
+ return
+
+ dialog = SearchDialog(index)
if dialog.run() == gtk.RESPONSE_OK:
self.set_revision(dialog.get_revision())
More information about the bazaar-commits
mailing list