Comment 4 for bug 627202

Revision history for this message
Martin Pool (mbp) wrote :

So the reason this happens seems fairly obvious: we repacked 0 revisions and log(0) -> blam.

This ought to be reproducible but I can't work out quite how it is getting hit.

I tried this:

=== modified file 'tests/test_index.py'
--- tests/test_index.py 2010-05-14 14:57:37 +0000
+++ tests/test_index.py 2011-02-01 04:07:02 +0000
@@ -1,5 +1,6 @@
 # search, a bzr plugin for searching within bzr branches/repositories.
 # Copyright (C) 2008 Robert Collins
+# Copyright (C) 2011 Martin Pool
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License version 2 as published
@@ -637,6 +638,17 @@

 class TestAutoIndex(TestCaseWithTransport):

+ def test_index_empty_branch(self):
+ """No problems with indexing an empty repository.
+
+ See <http://pad.lv/627202>
+ """
+ # Indexing a repository
+ tree = self.make_branch_and_tree("foo")
+ search_index = index.init_index(tree.branch)
+ search_index.index_branch(tree.branch, tree.last_revision())
+ search_index.index_branch(tree.branch, tree.last_revision())
+
     def test_no_index_no_error(self):
         tree = self.make_branch_and_tree("foo")
         search._install_hooks()

I might just try a blind fix for it.