tests: fix breakage from locate deprecation
locate: add pointer to files command in help
templater: add "diff" template function

"diff" allows to embed changes in the target revision into template
output, even if the command itself doesn't take "--patch" option

Combination of "[committemplate]" configuration and "diff" template
function can achieve the feature like issue231 ("option to have diff
displayed in commit editor buffer")

    http://bz.selenic.com/show_bug.cgi?id=231

For example, templating below can be used to add each "diff" output
lines "HG: " prefix::

      {splitlines(diff) % 'HG: {line}\n'}

This patch implements "diff" not as "a template keyword" but as "a
template function" to take include/exclude patterns at runtime.

It allows to specify target files of command (by -I/-X command line
options) and "diff" separately.
buildrpm: introduce --prepare for preparing without actually building rpms
buildrpm: introduce --withpython for building rpms that includes Python 2.7
buildrpm: introduce --rpmdir instead of using hardcoded rpmbuild dir

Used as rpm _topdir when preparing spec and source and building rpms.
dockerrpm: check that docker is running correctly before building
dockerrpm: better handling of specification of docker name
dockerrpm: run docker build process as the current user, not as root

Docker can be run by ordinary users if they are in the docker group. The build
process would however be run as a root user, only protected by the sandboxing.
That caused problems with the shared directory where rpmbuild would be picky
about building from sources owned by less privileged users and producing files
owned by root.

Instead, add a build user with the right uid/gid to the image and run the
docker process as that user.
dockerrpm: prepare source outside docker and just run rpmbuild inside docker

Simplifies the rpm build process.

We will use platform specific rpmbuild directories and will not clean them and
will drop the explicit copy to build directory.
docker: use stable tags for fedora and centos

A moving target is rarely useful.

--HG--
rename : contrib/docker/fedora => contrib/docker/fedora20
docker: add CentOS 5

There is no official CentOS 5 docker template so we use one from saltstack.

--HG--
extra : amend_source : 8ad6a84c25d4eeb1ac279a143068976d4ee57f12
dockerrpm: create a yum/dnf repo from the generated rpms

This gives "PPA" functionality where users easily can stay uptodate with latest
nightly build.
wix: contrib/sample.hgrc is no more
contrib/synthrepo: return None to delete files on commit, don't raise IOError

The internal commit API was changed in 650b5b6e75ed to expect None from the
filectx function when a file is to be deleted, not an IOError. This change
keeps synthrepo up-to-date.
formatter: correct bool testing which should be __nonzero__ in Python 2
check-code: look for misuse of __bool__
revset: make descendants() lazier

Previously descendants() would force the provided subset to become a set.  In
the case of revsets like '(%ld::) - (%ld)' (as used by histedit) this would
force the '- (%ld)' set to be evaluated, which produced a set containing every
commit in the repo (except %ld). This takes 0.6s on large repos.

This changes descendants to trust the subset to implement __contains__
efficiently, which improves the above revset to 0.16s. Shaving 0.4 seconds off
of histedit.

revset #27: (20000::) - (20000)
0) obsolete feature not enabled but 54243 markers found!
! wall 0.023640 comb 0.020000 user 0.020000 sys 0.000000 (best of 100)
1) obsolete feature not enabled but 54243 markers found!
! wall 0.019589 comb 0.020000 user 0.020000 sys 0.000000 (best of 100)

This commit removes the final revset related perf hotspot from histedit.
Combined with the previous two patches, they shave a little over 3 seconds off
histedit on large repos.

--HG--
extra : amend_source : d5d7090a91a6289970311ee639bba0e5097a0e0c
revset: make parents() O(number of parents)

Strip executes a revset like this:

max(parents(_intlist('1234\x001235')) - _intlist('1234\x001235'))

Previously the parents() revset would do 'subset & parents' which iterates over
each item in the subset and checks if it's in parents.  subset is usually the
entire repo (a spanset) so this takes a while.

Reversing the parameters to be 'parents & subset' means the operation becomes
O(number of parents) instead of O(size of repo). It also means the result gets
evaluated immediately (since parents isn't a lazy set), but I think this is a
win in most scenarios.

This shaves 0.3 seconds off strip (amend/histedit/rebase/etc) for large repositories.

revset #0: parents(20000)
0) obsolete feature not enabled but 54243 markers found!
! wall 0.006256 comb 0.010000 user 0.010000 sys 0.000000 (best of 289)
1) obsolete feature not enabled but 54243 markers found!
! wall 0.000391 comb 0.000000 user 0.000000 sys 0.000000 (best of 4323)

--HG--
extra : amend_source : 99d652ce9c1329b060a90bb5be15c6a55c824a66
revset: lower weight for _intlist function

The histedit command uses a revset like:

(_intlist('1234\x001235')) and merge()

Previously the optimizer gave a weight of 1.5 to the _intlist side (1 for the
function, 0.5 for the string) which caused it to process the merge() side first.
This caused it to evaluate merge against every commit in the repo, which took
2.5 seconds on a large repo.

I changed the weight of _intlist to 0, since it's a trivial calculation, which
makes it process intlist first, which makes merge apply only to the revs in the
list. Which makes the revset take 0.15 seconds now. Cutting off 2.4 seconds off
our histedit performance.

>From the revset benchmark:
revset #25: (_intlist('20000\x0020001')) and merge()
0) obsolete feature not enabled but 54243 markers found!
! wall 0.036767 comb 0.040000 user 0.040000 sys 0.000000 (best of 100)
1) obsolete feature not enabled but 54243 markers found!
! wall 0.000198 comb 0.000000 user 0.000000 sys 0.000000 (best of 9084)