run-tests: '--time' option provide more details to Linux users

As our tests execute in child processes, this patch uses os.times()
module in replace of time.time() module to provide additional info like
user time and system time spent by child's processes along with real elapsed
time taken by a process.

There is one limitation of this patch. It can work only for Linux users and
not for Windows.

"os.times" module returns a 5-tuple of a floaing point numbers.
1) User time
2) System time
3) Child's user time
4) Child's system time
5) Ellapsed real time

On Windows, only the first two items are filled, the others are zero.
Therefore, below test cases does not break on Windows but instead gives the
zero value.

--HG--
extra : amend_source : 7b968db619206bcb2d787dbcec4685184d834e13
test-obsolete: better logging template

Gratuitous improvement of the test readability.

--HG--
extra : rebase_source : e40687ee8860be4178d76069fb51cc256ed89b68
graft: allow regrafting ancestors with --force (issue3220)

--HG--
extra : rebase_source : f50bc2790a2548faee77859fc4fa21c729a9d0d0
graft: make --force apply across continues (issue3220)

Since --force determines the list of revisions to be grafted, it doesn't really
make sense for users to have to keep typing --force --continue as they continue
grafting.

--HG--
extra : rebase_source : 9ee463f204a2e2e10d4159409cda65d950789543
keyword: really clean up kwdemo temp tree

--HG--
extra : rebase_source : 32f2e9ce71dac59f5e8283f5a7deb9bb68356c73
keyword: bump copyright year

--HG--
extra : rebase_source : fc48cd3a519562a7349657b3ce849166e5982177
purge: prefer util.unlink instead over own removefile

--HG--
extra : rebase_source : 87dba4db6f92824e3aa5456cd494009ba89904bc
dirstate: add a method to efficiently filter by match

Current callers that require just this data call workingctx.walk, which calls
dirstate.walk, which stats all the files. Even worse, workingctx.walk looks for
unknown files, significantly slowing things down, even though callers might not
be interested in them at all.

--HG--
extra : rebase_source : a9777559906badd80407f1314043cecf788afa14
context: add a method to efficiently filter by match if possible

For non-working contexts, walk and matches do the same thing. For working
contexts, walk stats all the files and looks for unknown files, while matches
just filters the dirstate by match.

--HG--
extra : rebase_source : 54f524b4bf8560eed9c8303e7716d0e2df15fef5
locate: use ctx.matches instead of ctx.walk

On mozilla-central, which is around 100,000 files, best of 5:

$ hg --time locate > /dev/null
before: real 1.460 secs (user 1.140+0.000 sys 0.320+0.000)
after:  real 0.620 secs (user 0.610+0.000 sys 0.020+0.000)

$ hg --time locate README > /dev/null
before: real 0.630 secs (user 0.330+0.000 sys 0.290+0.000)
after:  real 0.120 secs (user 0.110+0.000 sys 0.020+0.000)

Larger repositories see correspondingly larger performance gains.

--HG--
extra : rebase_source : 5cd977fed99cbc8ba5022b8cb2ee79a8b5ac8949
i18n: detect UI language without POSIX-style locale variable on Windows (BC)

On Windows, it isn't common to set LANG environment variable. This patch makes
gettext honor Windows-style UI language [1] if no locale variables are set.

Because of this change, LANG=C or HGPLAIN must be set in order to disable
translation on non-English Windows.

 [1]: http://msdn.microsoft.com/en-us/library/dd374098(v=VS.85).aspx

--HG--
extra : rebase_source : 90ec36636b1d5b204239e8914143287bd4a7556c
wireproto: add a ``boolean`` type for getbundle parameters

This will be used to control inclusion of some parts in a bundle2.
getbundle: add a ``cg`` boolean argument to control changegroup inclusion

The ``getbundle`` function was initially design to return a changegroup bundle.
However, bundle2 allows transmitting a wide range of data. Some bundle2
requests may not include a changegroup at all.

Before this changeset, the client would request a changegroup for
``heads=[nullid]`` and receive an empty changegroup.

We introduce an official boolean parameter, ``cg``, that can be set
to false to disable changegroup generation on getbundle. A new bundle2
capability is introduced to let the client know.
context: call normal on the right object

dirstate.normal is the method that marks files as unchanged/normal.

Rev 20a30cd41d21 started caching dirstate.normal in order to improve
performance. However, there was an error in the patch: taking the wlock, under
some conditions depending on platform, can cause a new dirstate object to be
created. Caching dirstate.normal before calling wlock would then cause the
fixup calls below to be on the old dirstate object, effectively disappearing
into the ether.

On Unix and Unix-like OSes, the condition under which we create a new dirstate
object is 'the dirstate file has been modified since the last time we opened
it'. This happens pretty rarely, so the object is usually the same -- there's
little impact.

On Windows, the condition is 'always'. This means files in the lookup state are
never marked normal, so the bug has a serious performance impact since all the
files in the lookup state are re-read every time hg status is run.

--HG--
branch : stable
extra : rebase_source : 1e04decc963acc3fb38bbaa086be756e1f2dc528
color: pass on key error for win32 (issue4298)

This is a quick fix for some consoles on windows (consoles that are not mingw
based) so that the debugcolor command doesn't throw a KeyError when effects
aren't supported (e.g. italic).

--HG--
branch : stable
extra : rebase_source : 6b16ea787f7fcc504f9ffaf771fbfb79d24406b1
merge with stable
run-tests: add iolock to failure output