Skip to content
Snippets Groups Projects
Commit c29e79d11b01 authored by Arseniy Alekseyev's avatar Arseniy Alekseyev
Browse files

test-dirstate: actually test the append code path in dirstate v2

Apparently it's not sufficient to modify a file to force the dirstate
write-out, so the append code path was untested.

By removing a file instead of changing we're forcing append to happen.
parent 477b5145e1a0
No related branches found
No related tags found
2 merge requests!124merge stable into default,!109rhg: align the dirstate v2 writing algorithm with python
......@@ -132,6 +132,10 @@
> hg debugstate --docket | grep uuid | sed 's/.*uuid: \(.*\)/\1/'
> }
$ find_dirstate_data_size () {
> hg debugstate --docket | grep 'size of dirstate data' | sed 's/.*size of dirstate data: \(.*\)/\1/'
> }
$ dirstate_uuid_has_not_changed () {
> # Non-Rust always rewrites the whole dirstate
> if [ $# -eq 1 ] || ([ -n "$HGMODULEPOLICY" ] && [ -z "${HGMODULEPOLICY##*rust*}" ]) || [ -n "$RHG_INSTALLED_AS_HG" ]; then
......@@ -162,5 +166,6 @@
Trigger an append with a small change
$ echo "modified" > dir2/f
$ current_data_size=$(find_dirstate_data_size)
$ rm dir2/f
$ hg st
......@@ -166,6 +171,6 @@
$ hg st
M dir2/f
! dir2/f
$ dirstate_data_files | wc -l
*1 (re)
$ dirstate_uuid_has_not_changed
not testing because using Python implementation (no-rust no-rhg !)
......@@ -168,7 +173,12 @@
$ dirstate_data_files | wc -l
*1 (re)
$ dirstate_uuid_has_not_changed
not testing because using Python implementation (no-rust no-rhg !)
$ new_data_size=$(find_dirstate_data_size)
$ [ "$current_data_size" -eq "$new_data_size" ]; echo $?
0 (no-rust no-rhg !)
1 (rust !)
1 (no-rust rhg !)
Unused bytes counter is non-0 when appending
$ touch file
......@@ -177,5 +187,4 @@
Trigger a rust/rhg run which updates the unused bytes value
$ hg st
M dir2/f
A file
......@@ -181,4 +190,5 @@
A file
! dir2/f
$ dirstate_data_files | wc -l
*1 (re)
$ dirstate_uuid_has_not_changed
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment