tests: kill for windows in killdaemons.py checks return values

The return values of the windll calls are checked and when an error is
indicated, it is raised. The handle is still closed properly.
tests: killdaemons.py for windows waits for killed process to terminate

After kill, wait for the process to terminate. When it does not in time,
write a debug message similar as in other os. But no 2nd forceful attempt
is done.
tests: killdaemons.py for checks reason when getting no process handle
tests: killdaemons.py for windows distinguishes access violation and terminated

To distinguish between access violaition (process belonging to another user)
and a terminated process, PROCESS_QUERY_INFORMATION must be enabled. But
TerminateProcess still raises error 5 in both cases. Therefore check before if
the process has already terminated.
commands.debugrevspec: add an option to print the optimized expression tree

This will be used in an upcoming patch to test that the optimizer works.
revset: add an undocumented _missingancestors function

This will be used in an upcoming patch to optimize expressions of the form
(::x - ::y).
revset: optimize missing ancestor expressions

A missing ancestor expression is any expression of the form (::x - ::y) or
equivalent. Such expressions are remarkably common, and so far have involved
multiple walks down the DAG, followed by a set difference operation.

With this patch, such expressions will be transformed into uses of the fast
algorithm at ancestor.missingancestor.

For a repository with over 600,000 revisions, perfrevset for '::tip - ::-10000'
returns:

Before: ! wall 3.999575 comb 4.000000 user 3.910000 sys 0.090000 (best of 3)
After:  ! wall 0.132423 comb 0.130000 user 0.130000 sys 0.000000 (best of 75)
import: move tryone closure in cmdutil

We extract the `tryone` function into the `cmdutil` module. A lot of the command
context have to be passed to the utility function, but having and explicit
declaration will allow extension to wrap it. This will allows use to make
changeset evolution related experiment in dedicated extension.

Improving the API of this function is noble goal but outside of the scope of
this patches.
discovery: improve "note: unsynced remote changes!" warning

This message frequently caused confusion. "unsynced" is not a well established
user-facing concept in Mercurial and the message was not very specific or
helpful.

Instead, show a message like:
  remote has heads on branch 'default' that are not known locally: 6c0482d977a3

This message will also (when relevant) be shown before aborting on "push
creates new remote head".

A similar (but actually very different) message was addressed in 6b618aa08b6e.
discovery: make "note: unsynced remote changes!" less serious than a warning

This situation is not necessarily a problem and do not deserve a warning. It is
just some information that can guide the user in understanding what is going
on.

Making it 'debug' would usually not give the hint when it is relevant so we
make it a 'status' message.