Merge lp:~mbp/bzr-search/627202-valueerror into lp:bzr-search

Proposed by Martin Pool
Status: Merged
Merged at revision: 85
Proposed branch: lp:~mbp/bzr-search/627202-valueerror
Merge into: lp:bzr-search
Diff against target: 12 lines (+1/-1)
1 file modified
index.py (+1/-1)
To merge this branch: bzr merge lp:~mbp/bzr-search/627202-valueerror
Reviewer Review Type Date Requested Status
Robert Collins Pending
Review via email: mp+48108@code.launchpad.net

Description of the change

https://bugs.launchpad.net/ubuntu/+source/bzr-search/+bug/627202

Several people report bzr crashes when bzr-search is installed, because of evaluating log(0) here.

I see this is because of reindexing a repository with no revisions, but in the time I spent, I could not work out how to reproduce that. So this just tries to guard against that case.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'index.py'
--- index.py 2010-12-14 14:02:13 +0000
+++ index.py 2011-02-01 04:24:08 +0000
@@ -442,7 +442,7 @@
442 if not allow_pack:442 if not allow_pack:
443 return443 return
444 total_revisions = self._revision_index.key_count()444 total_revisions = self._revision_index.key_count()
445 max_components = int(math.ceil(math.log(total_revisions, 2)))445 max_components = int(math.ceil(math.log(max(1, total_revisions), 2)))
446 if max_components < 1:446 if max_components < 1:
447 max_components = 1447 max_components = 1
448 excess = len(self._current_names) - max_components448 excess = len(self._current_names) - max_components

Subscribers

People subscribed via source and target branches

to all changes: