transaction: fix file descriptor leak for journal.backupfiles

The journal.backupfiles descriptor wasn't being closed. This resulted in
hgsubversion test runs having a bagillion descriptors open, which crashed on
platforms with low open file limits (like OSX).

--HG--
branch : stable
spanset: directly use __contains__ instead of a lambda

Spanset are massively used in revset. First because the initial subset itself is
a repo wide spanset. We speed up the __and__ operation by getting rid of a
gratuitous lambda call. A more long terms solution would be to:

1. speed up operation between spansets,
2. have a special smartset for `all` revisions.

In the mean time, this is a very simple fix that buyback some of the performance
regression.

Below is performance benchmark for trival `and` operation between two spansets.
(Run on an unspecified fairly large repository.)

revset tip:0
2.9.2)  wall 0.282543 comb 0.280000 user 0.260000 sys 0.020000 (best of 35)
before) wall 0.819181 comb 0.820000 user 0.820000 sys 0.000000 (best of 12)
after)  wall 0.645358 comb 0.650000 user 0.650000 sys 0.000000 (best of 16)

Proof of concept implementation of an `all` smartset brings this to 0.10 but it's
too invasive for stable.

--HG--
branch : stable
tests: add repository check for pyflakes test

If this test was run from a tarball with no Mercurial repository, it
would fail because 'hg manifest' didn't work.

--HG--
branch : stable
largefiles: better handling of log from other working directory (issue4236)

When invoked from another directory, the matchers m._cwd will be the absolute
path. The code for calculating relative path to .hglf did not consider that and
log would fail with weird errors and paths.

For now, just don't do any largefile magic when invoked from other directories.

--HG--
branch : stable
extra : amend_source : d0d13db8e77c1827b139290a2a0dc0a25ee057c1
rebase: empty revset should be a gentle no-op with exit code 1, not an error

--HG--
branch : stable
extra : rebase_source : efdef547673f2569ea5014815f08d82c3c9d0717