tests: factor external procedures out for portability
Fortunately, "&&" is treated as "execute next, if previous doesn't
fail" both on POSIX and Windows. But keeping portability of
"dirstaterace.command" manually is troublesome.
This patch factors external procedures out as a shell script for
portability. "sh SCRIPT" always allows scripting in POSIX style.
This change is also for convenience. Fixed script name can reduce
command line arguments.
"r" prefix is needed for "sh '$TESTTMP/dirstaterace.sh'", because
$TESTTMP contains backslash on Windows.
dirstate: add identity information to detect simultaneous changing in storage
This identity is used to examine whether dirstate is simultaneously
changed in storage after previous caching (see
issue5584 for detail).
util.cachestat can't be used for this purpose, because it has no
valuable information on Windows.
On the other hand, util.filestat can detect changing dirstate in
storage certainly, regardless of platforms.
https://www.mercurial-scm.org/wiki/ExactCacheValidationPlan
Strictly speaking, if underlying filesystem doesn't support
ctime/mtime, util.filestat can't detect simultaneous changing in
storage as expected. But simultaneous changing on such (very rare)
platform can't be detected regardless of this patch series.
Therefore, util.filestat should be reasonable identity for almost all
usecases.
util: make filestat.__eq__ return True if both of self and old have None stat
For convenience to compare two filestat objects regardless of
None-ness of stat field.