Merge lp:~mbp/bzr/687653-notbrancherror into lp:bzr/2.2
| Status: | Rejected | ||||
|---|---|---|---|---|---|
| Rejected by: | Martin Pool on 2010-12-16 | ||||
| Proposed branch: | lp:~mbp/bzr/687653-notbrancherror | ||||
| Merge into: | lp:bzr/2.2 | ||||
| Diff against target: |
259 lines (+44/-79) 4 files modified
NEWS (+7/-0) bzrlib/branch.py (+19/-5) bzrlib/errors.py (+16/-40) bzrlib/tests/test_errors.py (+2/-34) |
||||
| To merge this branch: | bzr merge lp:~mbp/bzr/687653-notbrancherror | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| bzr-core | 2010-12-10 | Pending | |
|
Review via email:
|
|||
Description of the Change
As discussed in <https:/
I'm targeting 2.2 so this can be rolled out on Launchpad.
This is a slight change in API behaviour because the bzrdir parameter is now ignored, but I think not really a break.
- 5119. By Martin Pool on 2010-12-10
-
Import urlutils just once into errors.py
| Andrew Bennetts (spiv) wrote : | # |
| Andrew Bennetts (spiv) wrote : | # |
An alternative fix... just add:
def __repr__(self):
return '<%s %r>' % (self._
The problem is that repr ought to be safe (and thus simple), and currently it can trigger arbitrary work, which allows this bug to happen.
Code that calls str(e) will still get a string suitable for displaying to users — including the "is a repository" hint.
| Martin Pool (mbp) wrote : | # |
I'm going to reject this in favor of spiv's fix in 2.2. In 2.3, I'm inclined to think we should just rip it out; the ui benefit is small and doing things from an exception class is bad.
Unmerged revisions
- 5119. By Martin Pool on 2010-12-10
-
Import urlutils just once into errors.py
- 5118. By Martin Pool on 2010-12-10
-
Smooth off handling of details and bzrdir in NotBranchError and update tests
- 5117. By Martin Pool on 2010-12-10
-
Remove misleading unused variables
- 5116. By Martin Pool on 2010-12-10
-
Trim unused import
- 5115. By Martin Pool on 2010-12-10
-
Don't probe for a repository from within formatting of a `NotBranchError`,
because this can cause knock-on errors. Instead, in cases where it would be
useful to tell the users that a directory contains a repository but not a
branch, check for it when raising the error.

I'm a bit worried about the performance impact. grepping for places that catch NotBranchError, and then eyeballing them to ignore places that are actually catching NotBranchError from opening a BzrDir rather than a branch, I see a fair few places that are likely to be incurring extra round-trips. The most serious is probably cmd_switch. Other places are less common and/or performance sensitive situations, like cmd_pack, cmd_whoami, BzrDir.sprout where the bzrdir has a repo but no branch.
I think all the HPSS effort tests still pass, so that's a good sign. But it definitely smells a bit, so we're trading one smell for another... probably an ok tradeoff, but it does make me hesitate.
On the plus side you can remove the str(e) call from SmartServerRequ estOpenBranchV3 .
If the test suite passes it's definitely safe for Launchpad to cherrypick.