scmutil: create directories in a race-safe way during update

With the new parallel update code, it is possible for multiple
workers to try to create a hierarchy of directories at the same
time. This is hard to trigger in general, but most likely during
initial checkout.

To deal with these races, we introduce a new ensuredirs function
whose contract is to ensure that a directory hierarchy exists - it
will ignore a failure that implies that the desired directory already
exists.
blackbox: adds a blackbox extension

Adds a blackbox extension that listens to ui.log() and writes the messages to
.hg/blackbox.log. Future commits will use ui.log() to log commands, unhandled
exceptions, incoming changes, and hooks.  The extension defaults to logging
everything, but can be configured via blackbox.track to only log certain events.
Log lines are of the format:  "date time user> message"

Example log line:
2013/02/09 08:35:19 durham> 1 incoming changes - new heads: d84ced58aaa

--HG--
extra : amend_source : b96df18ec32491ba047b8aba5f3b104be0e4e564
blackbox: log the commands that are run

Uses ui.log to log which commands are run, their exit code, the time taken,
and any unhandled exceptions thrown.

Example log lines:
2013/02/09 08:35:19 durham> add foo
2013/02/09 08:35:19 durham> add exited 0 after 0.02 seconds

Updates the progress tests because they use a mocked time.time() which these
changes affect.

--HG--
extra : amend_source : 00f0c58a856224248cda75b50638b18235b18c1f
blackbox: logs python and extension hooks via ui.log()

Logs python and extension hooks to ui.log() for viewing in the blackbox.

Example log lines:
2013/02/09 08:35:19 durham> pythonhook-preupdate: hgext.eol.preupdate finished in 0.01 seconds
2013/02/09 08:35:19 durham> exthook-update: echo hooked finished in 0.02 seconds

--HG--
extra : amend_source : d2296ae36ff3e0e954363e3830401b18d46d3c4f
blackbox: log incoming changes via ui.log()

Logs incoming changes to a repo to ui.log(). Includes the number of changes
and the hashes of the heads after the new changes.

Example log line:
2013/02/09 08:35:19 durham> 1 incoming changes - new heads: cb9a9f314b8b

Currently the blackbox logs the unix user that is performing the push/pull.
It would be nice to log the http authorized user as well so it works with
hgweb, but that's outside the scope of this commit.

--HG--
extra : amend_source : e52255ad109742eeffb25d07c7921f237b286a66
blackbox: adds a 'blackbox' command for viewing recent logs

Adds a 'hg blackbox' command for viewing the latest entries in the blackbox log.
By default it shows the last 10 entries, but -l allows the user to specify.
blackbox: tests for the blackbox extension

A few tests to cover the blackbox extension. Covers commands, hooks, and
incoming changes.
blackbox: fix a failing pyflakes test
blackbox: fix copyright
blackbox: only show new heads on incoming

The blackbox was logging every head after every incoming group.
Now we only log the heads that have changed.

Added a test.  Moved the hooks test to the bottom of the file since
the hooks interfer with the tests after it.
util: make ensuredirs safer against races
tests: quickly check if the glob line already matches the output

This happens when a path with "/" as only glob char is matched on a non windows
platform. (Currently one third of all glob matches.)
The slowdown on windows and the speedup on other os are neglectable.
tests: inform on Windows about unnecessary glob lines

When glob lines directly match on windows, "/" (and not "\") was output in the
path on the line. No glob matching is necessary in this case.

The test output will look like this (when 5 tests have passed and no 4 has an
unnecessary glob):
...
Info, unnecessary glob: info about some/thing (glob)
..

--HG--
extra : rebase_source : fc340183c1f7b5633a6415bdd3806eccfcc00eea
merge with stable
revset: change ancestor to accept 0 or more arguments (issue3750)

Change ancestor to accept 0 or more arguments. The greatest common ancestor of a
single changeset is that changeset. If passed no arguments, the empty list is
returned.

--HG--
extra : rebase_source : 332b00e1901ce8613c3f6f6d7ff8cf8535aa2f32
dates: support 'today' and 'yesterday' in parsedate (issue3764)

Adding support to parsedate in util module to understand the more idiomatic
dates 'today' and 'yesterday'.

Added unified tests and docstring tests for added functionality.

--HG--
extra : rebase_source : 9a7643e8907cd6905c7a85a80f3b9fd5e3df9c45
commit: show active bookmark in commit editor helper text

If there is an active bookmark while committing, the bookmark name
will be visible inside the commit message helper, below the branch
name.

This should make easier for the user to detect a mistaken commit
parent, while working for example with a bookmark centric workflow
like topic branches.

The active bookmark is checked to be in the working directory, as
pointed by Kevin Bullock, because otherwise committing would not
advance it. In other words, this would not show the active
bookmark name if the user changed the working tree parents with
'hg debugsetparents', for example.
merge: delay prompts a bit and show them in (extra) sorted order

Preparing for backout of 760c0d67ce5e.

The number of prompts will for all relevant cases be significantly smaller than
the total number of files in the manifests. We can thus afford to sort the
prompts more than we can afford to sort the manifests.
merge: make all action tuples have the same length - keep args as tuple
merge: delay debug messages for merge actions

Show messages at a point where the actions have been sorted, thus preparing for
backout of 760c0d67ce5e.

This makes manifestmerge more of a silent operation, just like 'copies' is.

Indent 'preserving' messages to make them subordinate to the action logging so
they fit in the new context. (The 'preserving' messages are quite redundant and
could also be removed completely.)