tests: use (esc) markup for string-escape
This makes test output less ambiguous.
Failing test output will be escaped and marked up if necessary. A Python
string-escape compatible encoding is used, but not everything is encoded -
especially not \n and \t and '.
tests: (no-eol) markup for command output without trailing LF
Output chunks without a trailing LF will now work but get (no-eol) appended.
This change mostly moves code around so we can handle that an output line
starts with data from previous command, followed by salt and the next command.
opener: check hardlink count reporting (
issue1866)
The Linux CIFS kernel driver (even in 2.6.36) suffers from a hardlink
count blindness bug (lstat() returning 1 in st_nlink when it is expected
to return >1), which causes repository corruption if Mercurial running
on Linux pushes or commits to a hardlinked repository stored on a Windows
share, if that share is mounted using the CIFS driver.
This patch works around
issue1866 and improves the workaround done in
50523b4407f6 to fix
issue761, by teaching the opener to lazily execute a
runtime check (new function checknlink) to see if the hardlink count
reported by nlinks() can be trusted.
Since nlinks() is also known to return varying count values (1 or >1)
depending on whether the file is open or not and depending on what client
and server software combination is being used for accessing and serving
the Windows share, we deliberately open the file before calling nlinks() in
order to have a stable precondition. Trying to depend on the precondition
"file closed" would be fragile, as the file could have been opened very
easily somewhere else in the program.
util: refactor opener
- Don't call atomictempfile or nlinks() if the path is malformed
(no basename). Let posixfile() raise IOError directly.
- atomictempfile already breaks up hardlinks, no need to poke
at the file with nlinks() if atomictemp.
- No need to copy the file contents to break hardlinks for 'w'rite
modes (w, wb, w+, w+b). Unlinking and recreating the file is faster.
revset: fix p1, p2 and parents in dirstate case (
a5f7f1e9340e)
- Handle 'subset' argument
- Stop returning the null rev from p1 and parents, as in the non-dirstate case
- Order parents as in the non-dirstate case (ascending revs)
tests: handle .t files without trailing LF
9a2de8dae27b made this simple test-test.t succeed silently:
$ printf ' $ true' > test-test.t
but did not give a usable .err in this case:
$ printf ' $ false' > test-test.t
The missing LF will now be fixed in the test output and it will thus give a
test failure and a solution in the .err file.
alias: fall back to normal error handling for ambigious commands (fixes
issue2475)