Mercurial > hg
diff tests/test-status.t @ 47351:3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
`hg debugdirstate --dirs` also shows information stored in the dirstate
(for `read_dir` caching) about directories.
Differential Revision: https://phab.mercurial-scm.org/D10828
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Mon, 31 May 2021 19:54:41 +0200 |
parents | 5e12b6bfdd3e |
children | 9d58e54b5966 |
line wrap: on
line diff
--- a/tests/test-status.t Mon May 31 18:35:44 2021 +0200 +++ b/tests/test-status.t Mon May 31 19:54:41 2021 +0200 @@ -915,3 +915,46 @@ I A.hs I B.hs I ignored-folder/ctest.hs + +#if dirstate-v2 + +Check read_dir caching + + $ cd .. + $ hg init repo8 + $ cd repo8 + $ mkdir subdir + $ touch subdir/a subdir/b + $ hg ci -Aqm '#0' + +The cached mtime is initially unset + + $ hg debugdirstate --dirs --no-dates | grep '^d' + d 0 0 unset subdir + +It is still not set when there are unknown files + + $ touch subdir/unknown + $ hg status + ? subdir/unknown + $ hg debugdirstate --dirs --no-dates | grep '^d' + d 0 0 unset subdir + +Now the directory is eligible for caching, so its mtime is save in the dirstate + + $ rm subdir/unknown + $ hg status + $ hg debugdirstate --dirs --no-dates | grep '^d' + d 0 0 set subdir + +This time the command should be ever so slightly faster since it does not need `read_dir("subdir")` + + $ hg status + +Creating a new file changes the directory’s mtime, invalidating the cache + + $ touch subdir/unknown + $ hg status + ? subdir/unknown + +#endif