amend: preserve extra dict (issue3430)

--HG--
branch : stable
pager: preserve Hg's exit code (and fix Windows support) (issue3225)

This changes how the pager extension invokes the pager. Prior to this change,
the extension would fork Hg and exec the pager in the parent process. This
loses Hg exit code, and it doesn't work on Windows.

Now the pager is invoked using the subprocess library, and an atexit handler is
registered that makes Hg wait for the pager to exit before it exits itself.

Note that if you exit the pager before Hg is done running, you'll get an exit
code of 255, which is caused by Python blowing up due to a broken pipe. If you
set pager.quiet=True, you'll get the OS-level return code of 141.

--HG--
branch : stable
pager: remove quiet flag

With the pager running as a child process, exiting the pager doesn't
result in a broken pipe message. To distinguish the exit broken pipe code
from a mercurial abort we register the default action for SIGPIPE. This
results in a 141 exit code instead of a 255. On windows SIGPIPE doesn't
exists and a ValueError will be thrown.

--HG--
branch : stable
mq: backup local changes in qpop --force (issue3433)

--HG--
branch : stable
mq: backup local changes in qpush --force

qpush help says the following about --force:
1- When -f/--force is applied, all local changes in patched files will
   be lost.
2- Apply on top of local changes

In practice, qpush --force will attempt to apply the patch on top of
local changes, and on success will merge them in the pushed patch. On
failure, patched files will contain a mix of local changes (where the
patch could not apply) and a mix of patch changes (were it applied). So,
local changes are less lost than entangled with a mass of other changes.

This patch makes qpush --force backup all locally modified files touched
by the next patch being applied. When multiple patches are being pushed,
this logic is repeated for each patch. Note that modified but
successfully patched files are preserved as well.

--HG--
branch : stable
mq: add --no-backup for qpush/qpop/qgoto

--HG--
branch : stable
largefiles: follow normal codepath for addremove if non-largefiles repo (issue3249)

--HG--
branch : stable
addremove: document default similarity behavior (issue3429)

--HG--
branch : stable
largefiles: fix deletion of multiple missing largefiles (issue3329)

--HG--
branch : stable
revset: documentation typo "metatadata"

--HG--
branch : stable
revset: make matching() preserve input revision order

--HG--
branch : stable
parsers: use the correct maximum radix tree depth

Previously, we would not use more than half of a SHA-1 hash when
constructing and searching the tree.

--HG--
branch : stable
test-phases: test changing null revision phase

The behaviour is correct but for bad reasons: the repo.set() call in
phase command fails for '-1'. It should be rejected explicitely by phase
boundary commands, sadly this is hard to do because phase changes are
not applied atomically.
repair: no need to call filterunknown() in strip()

Calling strip() will eventually trigger localrepo.destroyed() which will
invalidate _parseroots. It will call filterunknown() upon reload.

Changes to test-keyword.t are related to commit --debug running after
either qpop or rollback.
phases: call filterunknown() in readroots()

One less function manipulating localrepo state.
phases: stop modifying localrepo in readroots()

phasedefaults is also passed explicitely to help the casual reader
understand where it is used without grepping all the sources.
phases: stop modifying localrepo in writeroots()

Also pass the phaseroots being written for clarity. repo._dirtyphases
was already reset to False at call site.
transplant: manually transplant pullable changesets with --log
localrepo:  cleanup var names and comments

Cosmetic cleanups.  Fix comment typo referring to the notion of multiple tips.
Make variable describing a generator end in 'gen'.
Fix another var containing a node not to end with 'rev'.
parser: use PyInt_FromSsize_t in index_stats

Eliminates

  mercurial/parsers.c(515) : warning C4244: 'function' : conversion from
  'Py_ssize_t' to 'long', possible loss of data
  mercurial/parsers.c(520) : warning C4244: 'function' : conversion from
  'Py_ssize_t' to 'long', possible loss of data
  mercurial/parsers.c(521) : warning C4244: 'function' : conversion from
  'Py_ssize_t' to 'long', possible loss of data

when compiling for Windows x64 target using the Microsoft compiler.

PyInt_FromSsize_t does not exist for Python 2.4 and earlier, so we define a
fallback in util.h to use PyInt_FromLong when compiling for Python 2.4.