aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/command/base.py
Commit message (Collapse)AuthorAgeFilesLines
* command: use mapfiles (JSON) instead of YAML for the command serverW. Trevor King2012-10-261-3/+3
|
* Ran update-copyright.py.W. Trevor King2012-10-161-1/+1
|
* Rewrite commands to use bugdirs instead of a single bugdir.W. Trevor King2012-08-291-9/+14
| | | | | | | The bulk of the work is in regard to XML, with new BugDir.xml and .from_xml methods to support the new <bugdir> entity. I also split the guts import_xml's ._run method into sub-methods to make the import logic more obvious.
* command:serve_commands: new command for running a command server.W. Trevor King2012-08-241-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an initial step towards improving BE's efficiency. Previously, BE gets slow as the bug count increases for several commands (e.g. `be list`), because it takes time to load the bugdir information from disk at each invocation. If you use a remote repo (`be --repo http://localhost:8000/ list`), the server process may have already loaded the repo from disk, but now your listing process has to fetch everything over the wire. This is even worse than loading it from disk. With the new `be serve-commands` and `be --server URL ...` pair, the bugdir loading happens once on the server, and all the processing is also carried out on the server. This means that calls like `be --server http://localhost:8000/ list` will scale much better than other methods. For example: $ time be --server http://localhost:8000/ list > /dev/null real 0m2.234s user 0m0.548s sys 0m0.114s $ time be --server http://localhost:8000/ list > /dev/null real 0m0.730s user 0m0.548s sys 0m0.112s $ time be list > /dev/null real 0m2.453s user 0m2.289s sys 0m0.166s $ time be list > /dev/null real 0m2.521s user 0m2.350s sys 0m0.172s The first call to a cold server takes about the same time as a local call, because you need to load the bugs from the filesystem. However, later calls to a warm server are 3x faster, while later local calls are still slow. This is currently a minimal working implementation. There's a good deal of code in libbe.command.serve that I'd like to abstract out into a libbe.util library (since there's still a bunch of duplication between libbe.command.serve and libbe.command.serve_commands). The remote calls are also not as fast as I'd like, likely due to library load times. This commit just locks in an initial working implementation.
* command:base: only cleanup UseInterface.storage_callback if it's there.W. Trevor King2012-08-241-1/+2
| | | | | It's hard to see why it wouldn't be, but .setup_command handles the case where it's missing, so we should be consistent here.
* command:base: use is/is-not None instead of ==/!= None in setup_command.W. Trevor King2012-08-241-3/+3
| | | | More Pythonic.
* Avoid generating another StringIO instance in StringInputOutput.get_stdout().W. Trevor King2012-02-241-2/+1
|
* Ran update-copyright.py.W. Trevor King2012-02-161-10/+10
|
* Ran update_copyright.py.W. Trevor King2011-11-091-0/+1
|
* Add ImportError to UnknownCommand output in get_command doctest.W. Trevor King2011-07-301-0/+1
| | | | | | | | | | This catches the test result up after: Commit: 0d5c9c68e947617c9d073d5f19351bdd8f3866db Author: W. Trevor King <wking@drexel.edu> Date: Wed May 25 10:30:19 2011 -0400 Attach ImportError message to UnknownCommand to aid debugging.
* Attach ImportError message to UnknownCommand to aid debugging.W. Trevor King2011-05-251-3/+8
|
* Run update_copyright.py.W. Trevor King2011-05-251-1/+3
|
* Revive the UserError/UsageError distinctionW. Trevor King2011-05-021-5/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | UsageError was removed back in commit bf3d434b244c57556bec979acbc658c30eb58221 Author: W. Trevor King <wking@drexel.edu> Date: Sat Dec 12 00:31:55 2009 -0500 Added libbe.command.base (with Command class)... because the distinction between UsageError and UserError was unclear. I've brought it back to satisfy a request by Christian Heinrich: On Sun, May 01, 2011 at 02:52:13AM +0200, Christian Heinrich wrote: > 3.) Using wrong syntax should receive better help messages. > > Current: > > "be new" -> ERROR: > Missing required argument SUMMARY > > Should be: > > "be new" -> usage: be new [options] SUMMARY > ... He suggested we print the full option list as well, but I've decided to just print the usage summary and remind the user how to get the full help message if they want it.
* Merge commit 'refs/merge-requests/3' of git://gitorious.org/be/beChris Ball2011-01-081-1/+2
|\
| * Exclude --complete from completion.Robert Lehmann2010-11-261-1/+2
| |
* | Bumped to version 1.0.01.0.0Chris Ball2011-01-081-1/+1
|/
* Ran update_copyright.pyW. Trevor King2010-06-221-11/+12
|
* Use getreader (not getwriter) for wrapping stdinW. Trevor King2010-05-191-1/+1
|
* Fix command name output of `be --complete`.W. Trevor King2010-02-011-4/+33
| | | | | | | By adding command_names option to libbe.command.commands. Previous versions of `be --complete` printed "import_xml", not "import-xml". Also fixed libbe.command.base's doctests, so test.py can run them.
* Updated copyright informationW. Trevor King2010-01-011-1/+15
|
* Use fragment in base command completion + command io fixups.W. Trevor King2009-12-311-5/+11
|
* Added UserInterface and other improved abstractions for command handlingW. Trevor King2009-12-311-49/+172
|
* Fixed up the completion helpers in libbe.command.utilW. Trevor King2009-12-291-0/+6
| | | | | | | | | | This entailed a fairly thorough cleanup of libbe.util.id. Remaining unimplemented completion helpers: * complete_assigned() * complete_extra_strings() Since these would require scanning all (active?) bugs to compile lists, and I was feeling lazy...
* Allow external use of Command.usage() and use CmdOptionParser.set_usage()W. Trevor King2009-12-281-2/+2
| | | | | | | | | | | | | This fixes $ python be diff -2 Usage: be [options] be: error: no such option: -2 and we now get the correct output $ python be diff -2 Usage: be diff [options] [REVISION] be: error: no such option: -2
* Moved InvalidStorageVersion from libbe.command to libbe.storageW. Trevor King2009-12-271-11/+1
| | | | | | Also added ConnectionError pretty-print to ui.command_line, storage version checking to BugDir.duplicate_bugdir(), and optional revision argument to Storage.storage_version().
* Added storage.Storage.storage_version() and command.InvalidStorageVersion.W. Trevor King2009-12-271-0/+13
| | | | Now commands automatically check for storage version compatibility.
* Fixed libbe.command.diff + ugly BugDir.duplicate_bugdir implementationW. Trevor King2009-12-151-2/+2
| | | | | | | | | | | | | | | | | | | | | duplicate_bugdir() works, but for the vcs backends, it could require shelling out for _every_ file read. This could, and probably will, be horribly slow. Still it works ;). I'm not sure what a better implementation would be. The old implementation checked out the entire earlier state into a temporary directory pros: single shell out, simple upgrade implementation cons: wouldn't work well for HTTP backens I think a good solution would run along the lines of the currently commented out code in duplicate_bugdir(), where a VersionedStorage.changed_since(revision) call would give you a list of changed files. diff could work off of that directly, without the need to generate a whole duplicate bugdir. I'm stuck on how to handle upgrades though... Also removed trailing whitespace from all python files.
* Transition to Command-format complete.W. Trevor King2009-12-151-1/+1
| | | | | | | | Well, except for going through and updating the _long_help() strings. $ python test.py libbe.command succeeds for everything except Diff and Subscribe, which is expected since I haven't fixed up libbe.diff yet.
* Transitioned tag to Command-formatW. Trevor King2009-12-151-4/+1
|
* Transitioned severity to Command-format, also added Command._get_*()W. Trevor King2009-12-141-19/+54
| | | | | | | | | | | | | | The old .requires_* thing was rediculous. The new ._get_*() callbacks allow the caller to provide a means for getting the expensive structures, which the command can use, or not, as required. This will also make it easier to implement the completion callbacks. The callbacks should probably have matching .set_*() methods, to avoid the current cache tweaking cmd._storage = ... etc. But that can wait for now...
* Transitioned help to Command-formatW. Trevor King2009-12-141-0/+1
|
* Transitioned import_xml to Command-formatW. Trevor King2009-12-141-4/+19
|
* Transitioned comment to Command formatW. Trevor King2009-12-141-24/+81
|
* Transitioned init to Command formatW. Trevor King2009-12-141-4/+5
|
* Transitioned assign to Command formatW. Trevor King2009-12-141-2/+32
|
* Converted libbe.storage.vcs.base to new Storage format.W. Trevor King2009-12-131-3/+4
|
* Moved be to libbe.ui.command_line and transitioned to Command format.W. Trevor King2009-12-121-45/+57
|
* Use get_input/output_encoding() in libbe.command.base.CommandW. Trevor King2009-12-121-2/+3
|
* Moved command completion from libbe.ui.util to libbe.command.utilW. Trevor King2009-12-121-1/+0
|
* Added libbe.command.base (with Command class) and moved list command to new ↵W. Trevor King2009-12-121-0/+224
format.