Rev 553: Merge asking the user whether to create an index. in file:///data/jelmer/bzr-gtk/trunk/
Jelmer Vernooij
jelmer at samba.org
Fri Jul 18 16:19:23 BST 2008
At file:///data/jelmer/bzr-gtk/trunk/
------------------------------------------------------------
revno: 553
revision-id: jelmer at samba.org-20080718151921-lzf632mlqhups3io
parent: jelmer at samba.org-20080718124412-kzwx2807j7nd3mkw
parent: jelmer at samba.org-20080717123039-rnpqwdwtwp2uz8br
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Fri 2008-07-18 17:19:21 +0200
message:
Merge asking the user whether to create an index.
modified:
search.py search.py-20080701140205-dvpvrtf7n1qp2t8a-1
viz/branchwin.py branchwin.py-20051016222514-15fd120652fcf25c
------------------------------------------------------------
revno: 533.11.1
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-18 12:37:56 +0000
+++ b/viz/branchwin.py 2008-07-18 15:19:21 +0000
@@ -477,8 +477,25 @@
_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:
+ dialog.destroy()
+ index = _mod_index.index_url(self.branch.base)
+ else:
+ dialog.destroy()
+ return
+
+ dialog = SearchDialog(index)
if dialog.run() == gtk.RESPONSE_OK:
self.set_revision(dialog.get_revision())
More information about the bazaar-commits
mailing list