run-tests: make build command line less intimidating

Use a dict for parameters to the format string, instead of a
ridiculous number of positional parameters.
run-tests: add a --compiler option

Without this option, it is not possible to run the test suite on Windows
using mingw's gcc as the compiler.
run-tests: fix an unnoticed check-code violation
subrepo: use posixpath when diffing, for consistent paths

This fixes a Windows failure in test-subrepo-recursion.t introduced
by c84ef0047a94.
bisect: add example for limiting bisection to specified directories

The bisect command does not have an option to limit itself only to
subdirectories, but it's possible to use revsets for the --skip option
for the same effect. Given the relative obscurity of revsets, it helps
to have this as another example for bisect.
ancestor: faster algorithm for difference of ancestor sets

One of the major reasons rebase is slow in large repositories is
the computation of the detach set: the set of ancestors of the
changesets to rebase not in the destination parent. This is currently
done via a revset that does two walks all the way to the root of
the DAG. Instead of doing that, to find ancestors of a set <revs>
not in another set <common> we walk up the tree in reverse revision
number order, maintaining sets of nodes visited from <revs>, <common>
or both.

For the common case where the sets are close both topologically and
in revision number (relative to repository size), this has been
found to speed up rebase by around 15-20%. When the nodes are farther
apart and the DAG is highly branching, it is harder to say which
would win.

Here's how long computing the detach set takes in a linear repository
with over 400000 changesets, rebasing near tip:

Rebasing across 4 changesets
Revset method: 2.2s
New algorithm: 0.00015s

Rebasing across 250 changesets
Revset method: 2.2s
New algorithm: 0.00069s

Rebasing across 10000 changesets
Revset method: 2.4s
New algorithm: 0.019s
revlog: switch findmissing to use ancestor.missingancestors

This also speeds up other commands that use findmissing, like
incoming and merge --preview. With a large linear repository (>400000
commits) and with one incoming changeset, incoming is sped up from
around 4-4.5 seconds to under 3.
revlog: add rev-specific variant of findmissing

This will be used by rebase in an upcoming commit.

--HG--
extra : amend_source : 02c4b0c1373fcd4e4b93680c9bc413d2bbaf4909
rebase: use revlog.findmissingrevs to compute detach set
convert: add config option to use the local time zone

The default for the time zone offset in a converted changeset has
always been 0 (UTC).  With this patch, the converted changeset is
modified so that the local offset from UTC is specified as the time
zone offset.

The option is specified as the boolean convert.localtimezone (default
False).  Example usage:

    hg convert -s cvs --config convert.localtimezone=True example-cvs example-hg

IMPORTANT: the patch only applies to conversions from cvs or svn.
The documentation for the option only appears in those two sections
in the convert help text.
revlog: allow reverse iteration with revlog.revs

We often need to perform rev iteration in reverse order. This
changeset makes it possible to do so, in order to avoid costly reverse
or reversed() calls later.

--HG--
extra : amend_source : c7ea4f4b5e30a1c6f4a11001cc1a03c0192d0896
ancestor: fix a comment (followup to 0b03454abae7)
tests: only call check-code once

The accepted warnings list is now empty, let's try to keep it that way.

--HG--
extra : rebase_source : 704ff99c9802baaee9c7dfc22a6d27d8bae47f98
test-mq-qrefresh: test that the patch at qtip is indeed empty

...after qrefreshing a non-existent file

--HG--
extra : rebase_source : 37ff0834d2a3b1b147e8df109088009d0dbf88b3
revset: backed out changeset 54cedee86e51

This was causing clones of the hg repo to go from 12.4s to 14.7s.

--HG--
branch : stable
util: make chunkbuffer non-quadratic on Windows

The old str-based += collector performed very nicely on Linux, but
turns out to be quadratically expensive on Windows, causing
chunkbuffer to dominate in profiles.

This list-based version has been measured to significantly improve
performance with large chunks on Windows, with negligible overall
overhead on Linux (though microbenchmarks show it to be about 50% slower).

This may increase memory overhead where += didn't behave quadratically. If we
want to gather up 1G of data to join, we temporarily have 1G in our
list and 1G in our string.

--HG--
branch : stable
hooks: delay I/O redirection until we actually run a hook (issue3711)

We were attempting to redirect I/O even if no hook was actually
getting called. This defers redirection until we've found something to
do.

--HG--
branch : stable
hooks: be even more forgiven of non-fd descriptors (issue3711)

Looks like there are instances where sys.stdout/stderr contain file
handles that are invalid. We should be tolerant of this for hook I/O
redirection, as our primary concern is not garbling our own output stream.

--HG--
branch : stable
phases: fix missing "error" module import (issue3707)

--HG--
branch : stable
merge with stable