Merge lp:~amanica/bzr-guess/QnD_dont_guess_help_topics into lp:bzr-guess

Proposed by Marius Kruger
Status: Merged
Merged at revision: not available
Proposed branch: lp:~amanica/bzr-guess/QnD_dont_guess_help_topics
Merge into: lp:bzr-guess
Diff against target: 30 lines
1 file modified
__init__.py (+6/-0)
To merge this branch: bzr merge lp:~amanica/bzr-guess/QnD_dont_guess_help_topics
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Vincent Ladeuil Approve
Review via email: mp+13078@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Marius Kruger (amanica) wrote :

I've been running with this quickfix since I made it and it works fine.
I know it may not be a clean implementation, but given how critical this bug is for this plugin, I suggest merging my fix until the problem can be solved in a better way.

Revision history for this message
Vincent Ladeuil (vila) wrote :

At least the first part (if cmd_name is None: return) should be merged without hesitation.

The stack exploration is more questionable...

review: Approve
Revision history for this message
Robert Collins (lifeless) wrote :

 review: approve

I want to change the API so this isn't needed, but ETUITS.

Please land this on trunk - thanks.

-Rob

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '__init__.py'
2--- __init__.py 2009-07-03 08:25:33 +0000
3+++ __init__.py 2009-10-08 16:45:19 +0000
4@@ -17,6 +17,7 @@
5 """guess - when a bzr command is mispelt, prompt for the nearest match."""
6
7
8+import traceback
9 from bzrlib import commands, patiencediff, ui
10
11
12@@ -27,6 +28,8 @@
13
14
15 def guess_command(cmd_name):
16+ if not cmd_name:
17+ return
18 names = set()
19 for name in commands.all_command_names():
20 names.add(name)
21@@ -53,6 +56,9 @@
22 costs = sorted((value, key) for key, value in costs.iteritems())
23 if not costs:
24 return
25+ for tr in traceback.format_stack(limit=6):
26+ if "in help" in str(tr):
27+ return
28 candidate = costs[0][1]
29 prompt = "Command '%s' not found, perhaps you meant '%s'" % (
30 cmd_name, candidate)

Subscribers

People subscribed via source and target branches

to all changes: