Rev 48: Merge -d support for search in http://people.ubuntu.com/~robertc/baz2.0/plugins/search/trunk

Robert Collins robertc at robertcollins.net
Sat Jul 12 07:26:14 BST 2008


At http://people.ubuntu.com/~robertc/baz2.0/plugins/search/trunk

------------------------------------------------------------
revno: 48
revision-id: robertc at robertcollins.net-20080712062611-im40p0nziufimd5c
parent: robertc at robertcollins.net-20080711124159-qkfnq3ep9q1dvef9
parent: jelmer at samba.org-20080701132834-m8m4suatgx3t571w
committer: Robert Collins <robertc at robertcollins.net>
branch nick: trunk
timestamp: Sat 2008-07-12 16:26:11 +1000
message:
  Merge -d support for search
modified:
  commands.py                    commands.py-20080608052041-z5bahsl8kwl0uf4x-5
  tests/test_blackbox.py         test_blackbox.py-20080608052041-z5bahsl8kwl0uf4x-9
    ------------------------------------------------------------
    revno: 45.1.1
    revision-id: jelmer at samba.org-20080701132834-m8m4suatgx3t571w
    parent: robertc at robertcollins.net-20080629223307-wa3i8yi04sd2ay8e
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trunk
    timestamp: Tue 2008-07-01 15:28:34 +0200
    message:
      Add -d option to the search command.
    modified:
      commands.py                    commands.py-20080608052041-z5bahsl8kwl0uf4x-5
      tests/test_blackbox.py         test_blackbox.py-20080608052041-z5bahsl8kwl0uf4x-9
=== modified file 'commands.py'
--- a/commands.py	2008-06-28 07:22:10 +0000
+++ b/commands.py	2008-07-01 13:28:34 +0000
@@ -51,12 +51,14 @@
     encoding_type = 'replace'
     _see_also = ['index']
     takes_options = [Option('suggest', short_name='s',
-        help="Suggest possible terms to complete the search.")
+        help="Suggest possible terms to complete the search."),
+                     Option('directory', short_name='d', type=unicode,
+        help='Branch to search rather than the one in the current directory.'),
         ]
     takes_args = ['query+']
 
-    def run(self, query_list=[], suggest=False):
-        trans = get_transport('.')
+    def run(self, query_list=[], suggest=False, directory="."):
+        trans = get_transport(directory)
         index = _mod_index.open_index_url(trans.base)
         # XXX: Have a query translator etc.
         query = [(query_item,) for query_item in query_list]

=== modified file 'tests/test_blackbox.py'
--- a/tests/test_blackbox.py	2008-06-17 12:25:37 +0000
+++ b/tests/test_blackbox.py	2008-07-01 13:28:34 +0000
@@ -48,6 +48,15 @@
         self.assertEqual('', err)
         self.assertEqual("Revision id '%s'. Summary: 'first post'\n" % rev_id1, out)
 
+    def test_directory_option(self):
+        tree = self.make_branch_and_tree('otherdir')
+        init_index(tree.branch)
+        rev_id1 = tree.commit('first post')
+        index_url(self.get_url('otherdir'))
+        out, err = self.run_bzr(['search', '-d', 'otherdir', 'post'])
+        self.assertEqual('', err)
+        self.assertEqual("Revision id '%s'. Summary: 'first post'\n" % rev_id1, out)
+
     def test_summary_first_line(self):
         tree = self.make_branch_and_tree('.')
         init_index(tree.branch)




More information about the bazaar-commits mailing list