Fully expose TrackedBranch API

Was previously available in a limited read-only form as the
'trackedBranch' property on Review objects, for reviews tracking a remote
branch.

The TrackedBranch class is now exported on the critic module, and now has
the static TrackedBranch.find() function for finding arbitrary tracked
branches.

Also added a TrackedBranch.triggerUpdate() method for scheduling an
immediate update of the branch, TrackedBranch.{enable,disable} methods
for enabling and disabling the tracking, and TrackedBranch.getLogEntry()
for fetching the log entry (and pre-receive hook output) for the update
to a particular commit.
Testing framework improvements

- Split the test finding and selecting code out into a separate module,
  findtests.py (and rewrite it completely in the process.)

- Add support for encoding some basic information in comments at the top
  of tests files.  Currently supported is

    # @dependency (none|<path>)

  for explicitly specifying what other tests a test depends on, and

    # @flag <flag>

  for, well, setting flags.  The only flag with any meaning right now is
  "local" (more on that below.)

  In addition to reading the test file itself, an __init__.py file in a
  test directory can be used to set information shared by all tests in
  that directory and its sub-directories.

- Add unit testing support.  No actual unit tests added.

- Improve test selection argument interpretation.  Those arguments can now
  have a testing/tests/ prefix, which means tab completion can be used
  when specifying tests to run.

- Improve --pause-before / --pause-after interpretation.  They can now be
  patterns, interpreted in a similar fashion to the test selection
  arguments.  In particular, the pattern '*' can be used to pause before
  and/or after each selected test.  (Beware of the shell expanding such a
  command line argument, though.)

  The arguments can still also be used to specify pausing before or after
  a group (i.e. directory) of tests.

- Add support for running some tests locally without installing Critic
  first, by supplying the --local argument.  This will obviously only work
  for very few tests (typically unit tests.)  Those that support it need
  to have

    # @dependency none
    # @flag local

  to be selected.
Fix float division by zero

When calculating an appropriate number of hash rounds, if an attempt
was very fast, it might be measured as zero time, which would result
in a division by zero crash.
Restart Apache by stopping and starting with a pause between

Using "service apache2 restart" sometimes fails (with Apache 2.4,)
saying something like this:

  (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
  (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80

Feels a lot like a race between closing the listening socket and
recreating it.
Support anonymous users with AUTHENTICATION_MODE=="host"

Simply assume an anonymous user if there is no REMOTE_USER in the WSGI
environment.

Exactly what this translates to in practice depends on the host server's
configuration.  One possibility is that it is configured to support
anonymous access to specific paths only, such as /tutorial.
Don't hang during hash calibration for small minimums

Before this fix the installer would get stuck or run very long
inside the hash calibration loop for:

  install.py ... --minimum-password-hash-time 0.01
  install.py ... --minimum-password-hash-time 0.00001
  install.py ... --minimum-password-hash-time 0

Introduced by 2cba89d ("Fix float division by zero")
Escape links on /branches better

Branch names may contain characters that need escaping in URLs, like '#'.
Make sure to escape those.

For this purpose, add a helper class, htmlutils.URL, that constructs the
query part of the URL safely using urllib.urlencode().
Report "Missing param 'repository'" when there is no repository
Add TC for "Report "Missing param 'repository'" when there is no repository"
Escape branch name properly in SELECT for choosing new branch "base"

Repro:
1. push branch with commits A <- master "a#b_1"
2. push branch with commits B <- A <- master called "a#b_2"
2. push branch with commits C <- B <- A <- master called "a#b_3"
3. on /branches select "a#b_3" and choose "a#b_1" in
   the "select with base" dropdown
4. click "perform rebase" button
Fix error message when invalid base branch is specified
Add TC for "Fix error message when invalid base branch is specified"
Properly escape branch links in /showcommit info header
Drop unused imports in showcommit.py
Fix crash in critic.TrackedBranch.enable()

There was a comma missing from the SQL statement.
Add critic.Storage.list() method

Lets an extension list all keys in its extension storage.
Add critic.Storage.has() method

Allows for a more efficient way to check if a certain key exists in
the storage, in particular if the stored value is large (in which case
calling critic.Storage.get() is expensive.)
Move some imports around to depend less on having an installed system

It's nice, for unit testing purposes, if some basic modules can be
imported even if not running in an installed system, despite them not
really including that much functionality that is usable in that setting.

This commit makes it so, and adds unit tests that simply check that the
modules can be imported.
Extend operation parameter handling

Extend operation parameter handling to support higher-level parameter
type specifications such as Review, Repository and Commit, which means
the input value can be some basic type (typically int or str) that we can
unambiguously translate into the requested object, and that the value
actually passed to the operation's implementation is a high-level object
(such as dbutils.Review, gitutils.Repository or gitutils.Commit.)

Also split operation/__init__.py into a few different modules, reducing
the actual __init__.py into just importing selected names from the new
modules.  It had grown slightly out of control, in particular with the
other changes made here.
Use operation.Review for review argument to /{prepare,revert}rebase

These operation are used extensively in tests, so are "safe" to modify.