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
1=== modified file 'index.py'
2--- index.py 2010-12-14 14:02:13 +0000
3+++ index.py 2011-02-01 04:24:08 +0000
4@@ -442,7 +442,7 @@
5 if not allow_pack:
6 return
7 total_revisions = self._revision_index.key_count()
8- max_components = int(math.ceil(math.log(total_revisions, 2)))
9+ max_components = int(math.ceil(math.log(max(1, total_revisions), 2)))
10 if max_components < 1:
11 max_components = 1
12 excess = len(self._current_names) - max_components

Subscribers

People subscribed via source and target branches

to all changes: