aboutsummaryrefslogtreecommitdiffstats
path: root/libbe
Commit message (Collapse)AuthorAgeFilesLines
* command:serve_commands: new command for running a command server.W. Trevor King2012-08-243-4/+709
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* command:serve: wrap server in ExceptionApp regardless of SSL.W. Trevor King2012-08-241-1/+1
| | | | Previously, only the SSL server was using ExceptionApp.
* util:http: add ability to pass raw POST data with get_post_url.W. Trevor King2012-08-241-10/+17
|
* util:http: convert urllib2.URLError into HTTPError in get_post_url.W. Trevor King2012-08-241-5/+11
| | | | | Also rework liburl2.HTTPError handling to get both the reason and the error code into the HTTPError message.
* util:http: pull HTTP helpers from libbe.storage.http into their own module.W. Trevor King2012-08-243-106/+130
| | | | This way they can be shared with the upcoming Command._run_remote.
* storage:http: use an explicit relative import for base.W. Trevor King2012-08-241-2/+3
|
* storage:http: adjust HTTPError message in get_post_url.W. Trevor King2012-08-241-2/+2
| | | | | | We'll usually get this message if we fail to reach the server, but we can also get it if the server is so broken that it dies without returning a valid HTTP response.
* storage:http: add agent argument to get_post_url.W. Trevor King2012-08-241-2/+4
| | | | | This allows us to set an appropriate user agent if we use this function in other places (e.g. upcoming Command._run_remote).
* command:serve: add SilentRequestHandler to avoid double-logging requests.W. Trevor King2012-08-231-2/+8
| | | | | | | | | | | | | | | | They were being logged by the request handler, and then logged again by WSGI_Object.log_request. After this patch, requests are only logged when logger.level is at a <= level (e.g. closer to DEBUG) than the WSGI_Object.log_level (usually INFO). For example, in Serve_setup_logging, self.logger.setLevel(logging.INFO) will get request logs printed, but self.logger.setLevel(logging.WARNING) will not.
* libbe:util:plugin: cleanup recent zip/egg handling code.W. Trevor King2012-08-231-33/+16
| | | | | | | To test this, you'll need to build an egg. You can use setuptools to do this, by applying: <snip-patch>
* Cherrypick improved zipfile support from Niall Douglas.Niall Douglas (a [underscors] sourceforge {at} nedprod [dot] com)2012-08-231-9/+15
| | | | | | | | | | | WTK: This is the meat of Niall's commit 4632cb6d22faa7220540f92af67693084f80f033 Author: Niall Douglas ... Date: Wed Feb 22 17:46:06 2012 +0000 Fixed small bug where running from inside zip support was over preferring .pyc files
* Cherrypick initial zipfile support from Niall Douglas.Niall Douglas (a [underscors] sourceforge {at} nedprod [dot] com)2012-08-231-2/+27
| | | | | | | | | | | WTK: This is a portion of Niall's commit 7f7a7738bcbcfd06a026f2985c1823a4ba5eb55b Author: Niall Douglas ... Date: Tue Feb 21 20:35:28 2012 +0000 Several hacks to make BE compatible with bbfreeze and therefore compilable into a self contained directory
* storage:vcs:hg: remove grandchildren from Hg._vcs_listdir.W. Trevor King2012-08-231-1/+4
| | | | | | | | | | | | | | | This fixes: From: Phil Schumm Date: Thu, 23 Aug 2012 08:15:21 -0500 Subject: [Be-devel] -be diff- under Hg ... I've just noticed that -be diff- seems to yield different output under Git than it does under Hg (e.g., in a Mercurial +repository, -be diff- appears to show all changes as new bugs rather than modified). ...
* storage:base: add tests to catch grandchildren in .children() output.W. Trevor King2012-08-231-1/+51
| | | | | | | | | | | With a tree like: a `-- b `-- c children(a) should return [b], not [b, c] or [c]. This catches a bug in the Mercurial backend. Fix to follow.
* storage:vcs:hg: fix missformed file_a -> file_b message typo.W. Trevor King2012-08-231-1/+1
|
* Apply Niall's earlier fix for comment XML loading to bug XML loading.W. Trevor King2012-03-032-2/+3
| | | | Sometimes saxutils returns unicode.
* Make ID expansion less strict for comment text.W. Trevor King2012-03-031-3/+11
| | | | | This avoids errors if the comment text references a repository that you don't have locally.
* Fix `be import_xml` bugs.Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com)2012-03-032-3/+7
|
* Make the full UUIDs optional for `new` and `comment`.W. Trevor King2012-03-032-2/+14
| | | | | This makes the default output less threatening for new users, while still supplying the full UUIDs for driving BE from external software.
* Print full UUIDs during `new` and `comment`.Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com)2012-03-022-2/+2
|
* Added BE_INPUT_ENCODING and BE_OUTPUT_ENCODING to allow charset for stdin ↵Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com)2012-02-251-0/+8
| | | | and stdout to be overridden. This is necessary on Windows as there is no way for external programs to set stdin or stdout charsets :(
* I changed my mind and fixed #/03d07e61#.W. Trevor King2012-02-251-1/+9
|
* Keep stdin (file descriptor 0) open in the pager's child process.W. Trevor King2012-02-251-1/+0
| | | | | | | | | This fixes the underlying problem that we worked around in commit 2c9ae15f53aef57d28091b237c193c653c6e80dd. Now even $ echo 'some bug | be --paginate new - will work instead of raising IOError: [Errno 9] Bad file descriptor.
* Add `new` to list of commands that should not default to using the pager.W. Trevor King2012-02-251-1/+1
| | | | | | | | | | | | | | | | | | If the command is run in the pager, access to stdin is tricky, so I avoid it by default. I'd just missed the fact that `new -` used stdin, which caused https://bugzilla.redhat.com/show_bug.cgi?id=751473 $ be new - Traceback (most recent call last): ... File "/usr/lib/python2.7/site-packages/libbe/command/new.py", line 89, in _run summary = self.stdin.readline() ... File "/usr/lib64/python2.7/codecs.py", line 473, in read newdata = self.stream.read(size) IOError: [Errno 9] Bad file descriptor
* Hide the traceback on InvalidURL errors.W. Trevor King2012-02-251-0/+5
| | | | | | | | | In response to https://bugzilla.redhat.com/show_bug.cgi?id=733945 in which Neal Becker was bummed at the long traceback, which may initially look like a programming issue.
* Remove util.subproc.Pipe, as we no longer use it in BE.W. Trevor King2012-02-251-139/+0
| | | | | | | | | | This was at one point used by `update_copyright.py`. Now that that is an external package (and doesn't use `Pipe` anymore either), we can safely remove this code. As a side benifit, the Pipe doctests will no longer be there to fail on OS X and other systems sufficiently different from my development box.
* Avoid generating another StringIO instance in StringInputOutput.get_stdout().W. Trevor King2012-02-241-2/+1
|
* Add update-copyright as a submodule and update release.py accordingly.W. Trevor King2012-02-161-3/+3
| | | | Also add `**kwargs` to `invoke` so we can specify the environment.
* Ran update-copyright.py.W. Trevor King2012-02-1661-610/+610
|
* Fix my busted 1512c0e2a64e patch to libbe/util/encoding.py.W. Trevor King2011-11-135-9/+9
| | | | | | | | | | | | | | Some temporary changes to encoding.py seem to have been added to commit 1512c0e2a64e19c8d4e5697257a4df5ddd8bc727 Author: W. Trevor King <wking@drexel.edu> Date: Tue Nov 8 07:14:43 2011 -0500 by accident. The initial change came from discussions with Niall Douglas, during which I realized that "filesystem encoding" ususally means the encoding for the *path*, not the *contents*. To avoid further confusion I'd renamed `get_filesystem_encoding` to the less ambiguous `get_text_file_encoding`. This commit should complete the transition.
* Ran update_copyright.py.W. Trevor King2011-11-093-0/+3
|
* Correct doc/install.txt to refer to INSTALL_OPTIONS instead of PREFIX.W. Trevor King2011-11-081-6/+2
| | | | | | | This catches the docs up with the changes made in: commit a7ad89a6ad7da55089e6f9a4cdd645b7079ee04e Author: W. Trevor King <wking@drexel.edu> Date: Sat Apr 16 21:26:02 2011 -0400
* Add the BE_ENCODING environmental variable to override the default encoding.W. Trevor King2011-09-081-1/+3
|
* Adjust encoding detection (using sys.getfilesystemencoding for file contents).W. Trevor King2011-09-081-5/+8
|
* Fixed #/bc1e6ff4# (extra argument crash).W. Trevor King2011-09-071-2/+3
|
* Oops, that forgot the equals part of Mercurial 1.9 or greater.W. Trevor King2011-09-071-1/+1
|
* Adjust Mercurial execution so it works with version 1.9 and earlier.W. Trevor King2011-09-071-3/+9
| | | | | | | This makes the changes for 1.9 brought in by bb645f8e489b9f50cd0aec7237ec9adb721797a8 optional. If the Mercurial version is 1.9 or greater, the new code is used. Otherwise, the old code is used.
* Move Bzr.version_cmp to VCS.version_cmp.W. Trevor King2011-09-072-92/+91
| | | | The version comparison code will be useful for all VCSs.
* Merge remote branch 'pschumms/master'W. Trevor King2011-09-071-6/+4
|\
| * Minor fix to doctest for command.base.get_command(); failure introduced by ↵Phil Schumm2011-07-301-0/+1
| | | | | | | | change to command.base.UnknownCommand in commit 0d5c9c68e947617c9d073d5f19351bdd8f3866db
| * Fixed problem with Hg support under version 1.9 ↵Phil Schumm2011-07-281-6/+4
| | | | | | | | (mercurial.dispatch.dispatch() now takes a single request object with option for capturing output stream)
* | Remove redundant re import from previous bzr version_cmp patch.W. Trevor King2011-09-071-1/+0
| |
* | Enhance Bzr.version_cmp to handle non-numeric versionsMichel Alexandre Salim2011-09-071-9/+50
| | | | | | | | | | | | | | | | | | | | | | | | bzr uses non-numeric tags to indicate prereleases; previously, this triggers an exception in be's Bzr module as version comparison is only supported between version strings that only contain numbers and dots. This patch extends version_cmp to support a single non-numeric pre-release string of arbitrary length (e.g. 'a', 'b', 'pre', 'rc'), and extends the docstring tests to cover this extension. Signed-off-by: Michel Alexandre Salim <salimma@fedoraproject.org>
* | 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.
* | bugseverywhere.org has changed URL handling, so use different URLs for HTTP ↵W. Trevor King2011-07-301-3/+3
|/ | | | testing.
* Raise UserError if summary is not given to `be commit`.W. Trevor King2011-05-251-0/+3
| | | | | | | | | If the user doesn't provide the summary on the command line, through stdin, or through editor_string, raise an error. This will generally happen with $ be commit (user doesn't enter any text in the editory)
* Attach ImportError message to UnknownCommand to aid debugging.W. Trevor King2011-05-251-3/+8
|
* Rework summary handling in `be commit`.W. Trevor King2011-05-251-6/+18
| | | | | | Now you can run `be commit` with no options and have the summary split off the body automatically. This should be more familiar to most VCS users.