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
=== modified file '__init__.py'
--- __init__.py 2009-07-03 08:25:33 +0000
+++ __init__.py 2009-10-08 16:45:19 +0000
@@ -17,6 +17,7 @@
17"""guess - when a bzr command is mispelt, prompt for the nearest match."""17"""guess - when a bzr command is mispelt, prompt for the nearest match."""
1818
1919
20import traceback
20from bzrlib import commands, patiencediff, ui21from bzrlib import commands, patiencediff, ui
2122
2223
@@ -27,6 +28,8 @@
2728
2829
29def guess_command(cmd_name):30def guess_command(cmd_name):
31 if not cmd_name:
32 return
30 names = set()33 names = set()
31 for name in commands.all_command_names():34 for name in commands.all_command_names():
32 names.add(name)35 names.add(name)
@@ -53,6 +56,9 @@
53 costs = sorted((value, key) for key, value in costs.iteritems())56 costs = sorted((value, key) for key, value in costs.iteritems())
54 if not costs:57 if not costs:
55 return58 return
59 for tr in traceback.format_stack(limit=6):
60 if "in help" in str(tr):
61 return
56 candidate = costs[0][1]62 candidate = costs[0][1]
57 prompt = "Command '%s' not found, perhaps you meant '%s'" % (63 prompt = "Command '%s' not found, perhaps you meant '%s'" % (
58 cmd_name, candidate)64 cmd_name, candidate)

Subscribers

People subscribed via source and target branches

to all changes: