2017-06-03 08:27:52 +03:00
|
|
|
$ hg init repo
|
|
|
|
$ cd repo
|
2010-09-14 14:20:51 +04:00
|
|
|
$ echo a > a
|
|
|
|
$ hg add a
|
|
|
|
$ hg commit -m test
|
|
|
|
|
|
|
|
Do we ever miss a sub-second change?:
|
|
|
|
|
|
|
|
$ for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
|
|
|
|
> hg co -qC 0
|
|
|
|
> echo b > a
|
|
|
|
> hg st
|
|
|
|
> done
|
|
|
|
M a
|
|
|
|
M a
|
|
|
|
M a
|
|
|
|
M a
|
|
|
|
M a
|
|
|
|
M a
|
|
|
|
M a
|
|
|
|
M a
|
|
|
|
M a
|
|
|
|
M a
|
|
|
|
M a
|
|
|
|
M a
|
|
|
|
M a
|
|
|
|
M a
|
|
|
|
M a
|
|
|
|
M a
|
|
|
|
M a
|
|
|
|
M a
|
|
|
|
M a
|
|
|
|
M a
|
|
|
|
|
2017-06-03 08:27:52 +03:00
|
|
|
$ echo test > b
|
|
|
|
$ mkdir dir1
|
|
|
|
$ echo test > dir1/c
|
|
|
|
$ echo test > d
|
|
|
|
|
|
|
|
$ echo test > e
|
|
|
|
#if execbit
|
|
|
|
A directory will typically have the execute bit -- make sure it doesn't get
|
|
|
|
confused with a file with the exec bit set
|
|
|
|
$ chmod +x e
|
|
|
|
#endif
|
|
|
|
|
|
|
|
$ hg add b dir1 d e
|
2017-06-05 03:11:59 +03:00
|
|
|
adding dir1/c (glob)
|
2017-06-03 08:27:52 +03:00
|
|
|
$ hg commit -m test2
|
|
|
|
|
|
|
|
$ cat >> $TESTTMP/dirstaterace.py << EOF
|
|
|
|
> from mercurial import (
|
|
|
|
> context,
|
|
|
|
> extensions,
|
|
|
|
> )
|
|
|
|
> def extsetup():
|
|
|
|
> extensions.wrapfunction(context.workingctx, '_checklookup', overridechecklookup)
|
|
|
|
> def overridechecklookup(orig, self, files):
|
|
|
|
> # make an update that changes the dirstate from underneath
|
2017-06-09 07:07:49 +03:00
|
|
|
> self._repo.ui.system(r"sh '$TESTTMP/dirstaterace.sh'",
|
|
|
|
> cwd=self._repo.root)
|
2017-06-03 08:27:52 +03:00
|
|
|
> return orig(self, files)
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ hg debugrebuilddirstate
|
|
|
|
$ hg debugdirstate
|
|
|
|
n 0 -1 unset a
|
|
|
|
n 0 -1 unset b
|
|
|
|
n 0 -1 unset d
|
|
|
|
n 0 -1 unset dir1/c
|
|
|
|
n 0 -1 unset e
|
|
|
|
|
|
|
|
XXX Note that this returns M for files that got replaced by directories. This is
|
|
|
|
definitely a bug, but the fix for that is hard and the next status run is fine
|
|
|
|
anyway.
|
|
|
|
|
2017-06-09 07:07:49 +03:00
|
|
|
$ cat > $TESTTMP/dirstaterace.sh <<EOF
|
|
|
|
> rm b && rm -r dir1 && rm d && mkdir d && rm e && mkdir e
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ hg status --config extensions.dirstaterace=$TESTTMP/dirstaterace.py
|
2017-06-03 08:27:52 +03:00
|
|
|
M d
|
|
|
|
M e
|
|
|
|
! b
|
|
|
|
! dir1/c
|
|
|
|
$ hg debugdirstate
|
|
|
|
n 644 2 * a (glob)
|
|
|
|
n 0 -1 unset b
|
|
|
|
n 0 -1 unset d
|
|
|
|
n 0 -1 unset dir1/c
|
|
|
|
n 0 -1 unset e
|
|
|
|
|
|
|
|
$ hg status
|
|
|
|
! b
|
|
|
|
! d
|
|
|
|
! dir1/c
|
|
|
|
! e
|