blackbox: fix exception when logging commands with format characters

When running commands like 'hg export -o mypatch-%N.patch', the blackbox
would throw an exception because it tried to format %N. This change
prevents it from trying to format the command string.
setup.py: add metadata to register package to PyPI

This allows updating PyPI with just 'setup.py register' (assuming the user is
an owner or maintainer of the PyPI package).

--HG--
branch : stable
setup.py: ignore warnings from obsolete

Fix version detection with recent hg versions.

--HG--
branch : stable
sshpeer: store subprocess so it cleans up correctly

When running 'hg pull --rebase', I was seeing this exception 100% of the
time as the python process was closing down:

Exception TypeError: TypeError("'NoneType' object is not callable",) in
<bound method Popen.__del__ of <subprocess.Popen object at 0x937c10>> ignored

By storing the subprocess on the sshpeer, the subprocess seems to clean up
correctly, and I no longer see the exception. I have no idea why this actually
works, but I get a 0% repro if I store the subprocess in self.subprocess,
and a 100% repro if I store None in self.subprocess.

Possibly related to issue 2240.
strip: make --keep option not set all dirstate times to 0

hg strip -k was using dirstate.rebuild() which reset all the dirstate
entries timestamps to 0.  This meant that the next time hg status was
run every file was considered to be 'unsure', which caused it to do
expensive read operations on every filelog. On a repo with >150,000
files it took 70 seconds when everything was in memory.  From a cold
cache it took several minutes.

The fix is to only reset files that have changed between the working
context and the destination context.

For reference, --keep means the working directory is left alone during
the strip. We have users wanting to use this operation to store their
work-in-progress as a commit on a branch while they go work on another
branch, then come back later and be able to uncommit that work and
continue working.  They currently use 'git reset HARD^' to accomplish
this in git.
merge with crew-stable
check-code: do not prepend "warning" to a failure message

The prefix has not been removed when this check changed from a warning to a
failure.

--HG--
extra : rebase_source : dbe1f86deb1e3d5ebab0b371360177eb209e091e
rebase: restore active bookmark after rebase --continue

When a rebase has conflicts and the user uses rebase --continue, the previously
active bookmark was not being made active once again. With this change that
bookmark is made active again, just as if the rebase had never been interrupted.

This changes the rebasestate file format, but should handle old formats correctly.
Since the file is transient, this is even less of a problem.

Adds a test to verify the new behavior. I manually tested continuing rebases
with and without an active bookmark, and with and without being on the bookmark
being rebased.

--HG--
branch : stable
tests: fix test-profile to not depend on HGPROF environment variable

The test-profile test would fail if the user had HGPROF set to another
profiler in their environment.  This fix makes the test independent of
that environment variable.
merge with crew-stable
tests: fix test-profile to not depend on HGPROF environment variable

The test-profile test would fail if the user had HGPROF set to another
profiler in their environment.  This fix makes the test independent of
that environment variable.

Reverts the previous attempt to fix this, which was not cross platoform.
blackbox: add backup bundle paths to blackbox logs

Writes the backup bundle paths to the blackbox so it's easy to see which
backup bundle is associated with which command when you are debugging an
issue.

Example output:

2013/03/13 10:39:56 durham> strip tip
2013/03/13 10:39:59 durham> saved backup bundle to /data/users/durham/www-hg/.hg/strip-backup/e5fac262363a-backup.hg
2013/03/13 10:40:03 durham> strip tip exited 0 after 7.97 seconds

--HG--
extra : rebase_source : 99033ad7f3d9f807ddbea7508aba051406f33c42
bash_completion: match more narrowly

This greatly helps completion performance for most commands that deal
with files.

In a working dir with 150,000 files, where we want to complete the name
of a modified file under a path beginning with "a", from the root of
the working dir:

  (old) hg status -nm .            1.7 sec
  (new) hg status -nm "glob:a**"   0.3

Even "hg add" becomes a little faster, in spite of being the worst
case (matching untracked files).