branchcache: make _rbcrevslen handling more safe
self._rbcrevslen is used to keep track of the number of good records on disk.
It should thus not be updated before the records actually have been written to
disk.
branchcache: add debug output whenever cache files use truncate
The cache files are usually append only but will automatically be truncated and
recover in exceptional situations. Add a debug notice when such exceptional
situations are encountered.
tests: rework revision branch cache tests
The tests that were added with the revision branch cache in
678f53865c68 had
suffered from bit rot in the development iterations. They were no longer that
"good".
Now, the tests are rewritten and reworked to be more readable and maintainable
and relevant for the actual implementation.
This also utilizes the new 'f' helper tool for keeping an eye the cache files.
tests: add 'f' tool for cross platform file operations in the tests
This tool is like the collection of tools found in a unix environment but are
cross platform and stable and suitable for our needs in the test suite.
The main reason it is "needed" now is for hexdump of revision branch cache to
keep an eye on how it changes and make sure the format is stable.
It is a very generic tool that can end up being used a lot in tests, so I gave
it very generic name.
run-tests: include testdir in $PATH so tests easily can use helper tools
The testdir is already added to $PYTHONPATH - I think it makes sense and is
convenient to add it to $PATH too.
The following binaries are invoked from tests using full path with $TESTDIR/ -
they can now be used without specifying path:
dumbhttp.py
dummyssh
filterpyflakes.py
generate-working-copy-states.py
get-with-headers.py
hghave
histedit-helpers.sh
killdaemons.py
md5sum.py
notcapable
printenv.py
readlink.py
revlog-formatv0.py
run-tests.py
svn-safe-append.py
svnxml.py
tinyproxy.py
revlog: verify censored flag when hashing added revision fulltext
When receiving a delta via exchange, three possible storage outcomes emerge:
1. The delta is added directly to the revlog. ("fast-path")
2. A freshly-computed delta with a different base is stored.
3. The new revision's fulltext is computed and stored outright.
Both (2) and (3) require materializing the full text of the new revision by
applying the delta to its base. This is typically followed by a hash check.
The new flags argument allows callers to _addrevision to signal that they
expect that hash check to fail. We can use this opportunity to verify that
expectation. If the hash fails, require the flag be set; if the hash passes,
require the flag be unset.
Rather than simply eliding the hash check, this approach provides some
assurance that the censored flag is not applied to valid revisions.
Read more at: http://mercurial.selenic.com/wiki/CensorPlan