Merge lp:~ian-clatworthy/bzr/cmds-in-userref-585667 into lp:bzr
| Status: | Merged |
|---|---|
| Merged at revision: | 5379 |
| Proposed branch: | lp:~ian-clatworthy/bzr/cmds-in-userref-585667 |
| Merge into: | lp:bzr |
| Diff against target: |
35 lines (+7/-0) 2 files modified
bzrlib/commands.py (+1/-0) bzrlib/tests/test_commands.py (+6/-0) |
| To merge this branch: | bzr merge lp:~ian-clatworthy/bzr/cmds-in-userref-585667 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Robert Collins (community) | Needs Fixing on 2010-05-26 | ||
| Andrew Bennetts | 2010-05-26 | Abstain on 2010-05-26 | |
|
Review via email:
|
|||
Commit Message
Ensure builtin_
Description of the Change
bzrlib.
| Robert Collins (lifeless) wrote : | # |
Ian, can I ask what prompted this? It was quite deliberately changed
to not have any commands unless you come in through the command
handler logic.
Frontends *should* be deciding themselves what constitutes a built in command.
-Rob
| Ian Clatworthy (ian-clatworthy) wrote : | # |
> Ian, can I ask what prompted this? It was quite deliberately changed
> to not have any commands unless you come in through the command
> handler logic.
Bug 585667. Whomever deliberately changed the semantics of this API didn't grep through the codebase to see what would break. :-( Nor did they document it in NEWS (as far as I can tell) so numerous plugins might be broken by this as well.
> Frontends *should* be deciding themselves what constitutes a built in command.
Perhaps. I'd argue that front-ends ought to have the ability to provide their own built-in commands but falling back to bzr's builtin list is reasonable behaviour. FWIW, there's no public API for loading bzr's builtin commands so clients of the API are currently left up the creek.
One alternative fix to the one suggested would be to make _register_
| Robert Collins (lifeless) wrote : | # |
Yes, I'd prefer to have the only implicit-
'please run a bzr command'. I'd just call the existing method from the
doc generators - they're in tree, there is absolutely no reason they
shouldn't call the _ function as is.
-Rob
| Martin Pool (mbp) wrote : | # |
On 26 May 2010 17:20, Ian Clatworthy <email address hidden> wrote:
>> Ian, can I ask what prompted this? It was quite deliberately changed
>> to not have any commands unless you come in through the command
>> handler logic.
>
> Bug 585667. Whomever deliberately changed the semantics of this API didn't grep through the codebase to see what would break. :-( Nor did they document it in NEWS (as far as I can tell) so numerous plugins might be broken by this as well.
Hi, that was probably me, sorry. Thanks for catching it. I did grep
for callers but apparently didn't interpret the results well enough.
The point of the change was to let us load less code up front:
generally speaking not to load command classes until they're really
needed, either to run them or to get their help.
We could clean up a bit more the distinction between just getting the
list of names and loading them. I think this change is not
necessarily wrong but perhaps a better one is possible. If
test_import_tariffs passes I don't object to it.
I'll try to look more at this in a bit.
--
Martin <http://
| Robert Collins (lifeless) wrote : | # |
I meant to vote needsfixing when I suggested a fix.
| Martin Pool (mbp) wrote : | # |
> Yes, I'd prefer to have the only implicit-
> 'please run a bzr command'. I'd just call the existing method from the
> doc generators - they're in tree, there is absolutely no reason they
> shouldn't call the _ function as is.
I think it is reasonable for there to be a command that says "tell me about all the commands there are" - this may be slow if it has to go out and find them.
| Robert Collins (lifeless) wrote : | # |
> I think it is reasonable for there to be a command that says "tell me about all the commands there are" - this may be slow if it has to go out and find them.
Well there are such commands - bzr commands for instance. This is a
little lower level in the plumbing than that :)
-Rob
| Ian Clatworthy (ian-clatworthy) wrote : | # |
This was discussed further with Robert and Martin on IRC and we agreed to land it.
| Robert Collins (lifeless) wrote : | # |
sent to pqm by email
| Robert Collins (lifeless) wrote : | # |
This has conflicts in trunk.
| Martin Pool (mbp) wrote : | # |
resubmitted from lp:~mbp/bzr/lazy-commands
| Martin Pool (mbp) wrote : | # |
This actually fails, I would guess because of something related to recent changes for checking commands have help:
=======
FAIL: bzrlib.
-------
_StringException: Text attachment: log
------------
------------
Text attachment: traceback
------------
Traceback (most recent call last):
File "/usr/lib/
return fn(*args)
File "/usr/lib/
testMethod()
File "/home/
self.
AssertionError: ValueError not raised
------------
| Robert Collins (lifeless) wrote : | # |
This looks like a bad merge in the test_commands file, resurrecting a
deleted test.
| John A Meinel (jameinel) wrote : | # |
Setting this to needs review because it was approved but just needs some Patch Pilot love to finish it off.

Looks plausible to me, but I'm not certain what impact if any this would have on lazy-loading of command objects. I suspect it's fine, but its probably best for Martin or Rob to take a look.