tests/test-dirstate.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Fri, 23 Feb 2024 11:30:58 +0100
changeset 51432 e79c7320605f
parent 50222 ecd28d89c29e
permissions -rw-r--r--
chainsaw-update: use a graph with branching in graph This will be relevant for the next improvement of `chainsaw-update`.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48068
bf8837e3d7ce dirstate: Remove the flat Rust DirstateMap implementation
Simon Sapin <simon.sapin@octobus.net>
parents: 47281
diff changeset
     1
#testcases dirstate-v1 dirstate-v2
47129
93eb6c8035a9 dirstate-tree: Add a dirstate-v1-tree variant of some tests
Simon Sapin <simon.sapin@octobus.net>
parents: 45681
diff changeset
     2
47281
6763913fa175 dirstate-v2: Add a variant of some tests, that uses the new format
Simon Sapin <simon.sapin@octobus.net>
parents: 47129
diff changeset
     3
#if dirstate-v2
48235
5c567aca080d dirstate-v2: add an option to prevent unintentional slow dirstate-v2
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48223
diff changeset
     4
  $ cat >> $HGRCPATH << EOF
5c567aca080d dirstate-v2: add an option to prevent unintentional slow dirstate-v2
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48223
diff changeset
     5
  > [format]
48674
f7086f6173f8 dirstate-v2: rename the configuration to enable the format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48295
diff changeset
     6
  > use-dirstate-v2=1
48235
5c567aca080d dirstate-v2: add an option to prevent unintentional slow dirstate-v2
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48223
diff changeset
     7
  > [storage]
5c567aca080d dirstate-v2: add an option to prevent unintentional slow dirstate-v2
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48223
diff changeset
     8
  > dirstate-v2.slow-path=allow
5c567aca080d dirstate-v2: add an option to prevent unintentional slow dirstate-v2
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48223
diff changeset
     9
  > EOF
47281
6763913fa175 dirstate-v2: Add a variant of some tests, that uses the new format
Simon Sapin <simon.sapin@octobus.net>
parents: 47129
diff changeset
    10
#endif
6763913fa175 dirstate-v2: Add a variant of some tests, that uses the new format
Simon Sapin <simon.sapin@octobus.net>
parents: 47129
diff changeset
    11
11888
2bd699886ffc tests: combine test-dirstate-future.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 11887
diff changeset
    12
------ Test dirstate._dirs refcounting
7096
6dab29f6df37 dirstate._dirs: fix refcounting broken by 7dfac37cfabf
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    13
11887
76818b28ce98 tests: unify test-dirstatedirs
Adrian Buehlmann <adrian@cadifra.com>
parents: 7096
diff changeset
    14
  $ hg init t
76818b28ce98 tests: unify test-dirstatedirs
Adrian Buehlmann <adrian@cadifra.com>
parents: 7096
diff changeset
    15
  $ cd t
76818b28ce98 tests: unify test-dirstatedirs
Adrian Buehlmann <adrian@cadifra.com>
parents: 7096
diff changeset
    16
  $ mkdir -p a/b/c/d
76818b28ce98 tests: unify test-dirstatedirs
Adrian Buehlmann <adrian@cadifra.com>
parents: 7096
diff changeset
    17
  $ touch a/b/c/d/x
76818b28ce98 tests: unify test-dirstatedirs
Adrian Buehlmann <adrian@cadifra.com>
parents: 7096
diff changeset
    18
  $ touch a/b/c/d/y
76818b28ce98 tests: unify test-dirstatedirs
Adrian Buehlmann <adrian@cadifra.com>
parents: 7096
diff changeset
    19
  $ touch a/b/c/d/z
76818b28ce98 tests: unify test-dirstatedirs
Adrian Buehlmann <adrian@cadifra.com>
parents: 7096
diff changeset
    20
  $ hg ci -Am m
76818b28ce98 tests: unify test-dirstatedirs
Adrian Buehlmann <adrian@cadifra.com>
parents: 7096
diff changeset
    21
  adding a/b/c/d/x
76818b28ce98 tests: unify test-dirstatedirs
Adrian Buehlmann <adrian@cadifra.com>
parents: 7096
diff changeset
    22
  adding a/b/c/d/y
76818b28ce98 tests: unify test-dirstatedirs
Adrian Buehlmann <adrian@cadifra.com>
parents: 7096
diff changeset
    23
  adding a/b/c/d/z
76818b28ce98 tests: unify test-dirstatedirs
Adrian Buehlmann <adrian@cadifra.com>
parents: 7096
diff changeset
    24
  $ hg mv a z
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33954
diff changeset
    25
  moving a/b/c/d/x to z/b/c/d/x
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33954
diff changeset
    26
  moving a/b/c/d/y to z/b/c/d/y
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33954
diff changeset
    27
  moving a/b/c/d/z to z/b/c/d/z
17095
45cf6a91a02d dirstate: add dir/file collision test
Joshua Redstone <joshua.redstone@fb.com>
parents: 15447
diff changeset
    28
45cf6a91a02d dirstate: add dir/file collision test
Joshua Redstone <joshua.redstone@fb.com>
parents: 15447
diff changeset
    29
Test name collisions
45cf6a91a02d dirstate: add dir/file collision test
Joshua Redstone <joshua.redstone@fb.com>
parents: 15447
diff changeset
    30
45cf6a91a02d dirstate: add dir/file collision test
Joshua Redstone <joshua.redstone@fb.com>
parents: 15447
diff changeset
    31
  $ rm z/b/c/d/x
45cf6a91a02d dirstate: add dir/file collision test
Joshua Redstone <joshua.redstone@fb.com>
parents: 15447
diff changeset
    32
  $ mkdir z/b/c/d/x
45cf6a91a02d dirstate: add dir/file collision test
Joshua Redstone <joshua.redstone@fb.com>
parents: 15447
diff changeset
    33
  $ touch z/b/c/d/x/y
45cf6a91a02d dirstate: add dir/file collision test
Joshua Redstone <joshua.redstone@fb.com>
parents: 15447
diff changeset
    34
  $ hg add z/b/c/d/x/y
45cf6a91a02d dirstate: add dir/file collision test
Joshua Redstone <joshua.redstone@fb.com>
parents: 15447
diff changeset
    35
  abort: file 'z/b/c/d/x' in dirstate clashes with 'z/b/c/d/x/y'
45cf6a91a02d dirstate: add dir/file collision test
Joshua Redstone <joshua.redstone@fb.com>
parents: 15447
diff changeset
    36
  [255]
45cf6a91a02d dirstate: add dir/file collision test
Joshua Redstone <joshua.redstone@fb.com>
parents: 15447
diff changeset
    37
  $ rm -rf z/b/c/d
45cf6a91a02d dirstate: add dir/file collision test
Joshua Redstone <joshua.redstone@fb.com>
parents: 15447
diff changeset
    38
  $ touch z/b/c/d
45cf6a91a02d dirstate: add dir/file collision test
Joshua Redstone <joshua.redstone@fb.com>
parents: 15447
diff changeset
    39
  $ hg add z/b/c/d
45cf6a91a02d dirstate: add dir/file collision test
Joshua Redstone <joshua.redstone@fb.com>
parents: 15447
diff changeset
    40
  abort: directory 'z/b/c/d' already in dirstate
45cf6a91a02d dirstate: add dir/file collision test
Joshua Redstone <joshua.redstone@fb.com>
parents: 15447
diff changeset
    41
  [255]
45cf6a91a02d dirstate: add dir/file collision test
Joshua Redstone <joshua.redstone@fb.com>
parents: 15447
diff changeset
    42
11888
2bd699886ffc tests: combine test-dirstate-future.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 11887
diff changeset
    43
  $ cd ..
11887
76818b28ce98 tests: unify test-dirstatedirs
Adrian Buehlmann <adrian@cadifra.com>
parents: 7096
diff changeset
    44
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 11888
diff changeset
    45
Issue1790: dirstate entry locked into unset if file mtime is set into
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 11888
diff changeset
    46
the future
11888
2bd699886ffc tests: combine test-dirstate-future.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 11887
diff changeset
    47
2bd699886ffc tests: combine test-dirstate-future.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 11887
diff changeset
    48
Prepare test repo:
2bd699886ffc tests: combine test-dirstate-future.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 11887
diff changeset
    49
2bd699886ffc tests: combine test-dirstate-future.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 11887
diff changeset
    50
  $ hg init u
2bd699886ffc tests: combine test-dirstate-future.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 11887
diff changeset
    51
  $ cd u
2bd699886ffc tests: combine test-dirstate-future.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 11887
diff changeset
    52
  $ echo a > a
2bd699886ffc tests: combine test-dirstate-future.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 11887
diff changeset
    53
  $ hg add
2bd699886ffc tests: combine test-dirstate-future.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 11887
diff changeset
    54
  adding a
2bd699886ffc tests: combine test-dirstate-future.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 11887
diff changeset
    55
  $ hg ci -m1
2bd699886ffc tests: combine test-dirstate-future.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 11887
diff changeset
    56
2bd699886ffc tests: combine test-dirstate-future.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 11887
diff changeset
    57
Set mtime of a into the future:
2bd699886ffc tests: combine test-dirstate-future.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 11887
diff changeset
    58
48114
73bcfde21fc2 dirstate: push back the future a bit in the test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48068
diff changeset
    59
  $ touch -t 203101011200 a
11888
2bd699886ffc tests: combine test-dirstate-future.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 11887
diff changeset
    60
2bd699886ffc tests: combine test-dirstate-future.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 11887
diff changeset
    61
Status must not set a's entry to unset (issue1790):
2bd699886ffc tests: combine test-dirstate-future.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 11887
diff changeset
    62
2bd699886ffc tests: combine test-dirstate-future.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 11887
diff changeset
    63
  $ hg status
2bd699886ffc tests: combine test-dirstate-future.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 11887
diff changeset
    64
  $ hg debugstate
48114
73bcfde21fc2 dirstate: push back the future a bit in the test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48068
diff changeset
    65
  n 644          2 2031-01-01 12:00:00 a
17733
3c775c5a6c03 dirstate: handle large dates and times with masking (issue2608)
Matt Mackall <mpm@selenic.com>
parents: 17095
diff changeset
    66
3c775c5a6c03 dirstate: handle large dates and times with masking (issue2608)
Matt Mackall <mpm@selenic.com>
parents: 17095
diff changeset
    67
Test modulo storage/comparison of absurd dates:
11888
2bd699886ffc tests: combine test-dirstate-future.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 11887
diff changeset
    68
19092
8c560ad1cdc4 tests: AIX can't handle negative date in test-dirstate.t
Jim Hague <jim.hague@acm.org>
parents: 17737
diff changeset
    69
#if no-aix
17733
3c775c5a6c03 dirstate: handle large dates and times with masking (issue2608)
Matt Mackall <mpm@selenic.com>
parents: 17095
diff changeset
    70
  $ touch -t 195001011200 a
3c775c5a6c03 dirstate: handle large dates and times with masking (issue2608)
Matt Mackall <mpm@selenic.com>
parents: 17095
diff changeset
    71
  $ hg st
3c775c5a6c03 dirstate: handle large dates and times with masking (issue2608)
Matt Mackall <mpm@selenic.com>
parents: 17095
diff changeset
    72
  $ hg debugstate
3c775c5a6c03 dirstate: handle large dates and times with masking (issue2608)
Matt Mackall <mpm@selenic.com>
parents: 17095
diff changeset
    73
  n 644          2 2018-01-19 15:14:08 a
19092
8c560ad1cdc4 tests: AIX can't handle negative date in test-dirstate.t
Jim Hague <jim.hague@acm.org>
parents: 17737
diff changeset
    74
#endif
22406
2e47e461d2ca dirstate: add test for exceptions during updates
Durham Goode <durham@fb.com>
parents: 19092
diff changeset
    75
2e47e461d2ca dirstate: add test for exceptions during updates
Durham Goode <durham@fb.com>
parents: 19092
diff changeset
    76
Verify that exceptions during a dirstate change leave the dirstate
2e47e461d2ca dirstate: add test for exceptions during updates
Durham Goode <durham@fb.com>
parents: 19092
diff changeset
    77
coherent (issue4353)
2e47e461d2ca dirstate: add test for exceptions during updates
Durham Goode <durham@fb.com>
parents: 19092
diff changeset
    78
2e47e461d2ca dirstate: add test for exceptions during updates
Durham Goode <durham@fb.com>
parents: 19092
diff changeset
    79
  $ cat > ../dirstateexception.py <<EOF
33954
b9765319880e tests: update test-dirstate to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 26587
diff changeset
    80
  > from mercurial import (
b9765319880e tests: update test-dirstate to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 26587
diff changeset
    81
  >   error,
b9765319880e tests: update test-dirstate to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 26587
diff changeset
    82
  >   extensions,
44856
b7808443ed6a mergestate: split out merge state handling code from main merge module
Augie Fackler <augie@google.com>
parents: 42456
diff changeset
    83
  >   mergestate as mergestatemod,
33954
b9765319880e tests: update test-dirstate to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 26587
diff changeset
    84
  > )
22406
2e47e461d2ca dirstate: add test for exceptions during updates
Durham Goode <durham@fb.com>
parents: 19092
diff changeset
    85
  > 
42456
87a34c767384 merge: fix race that could cause wrong size in dirstate
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 35393
diff changeset
    86
  > def wraprecordupdates(*args):
45681
a736ab681b78 errors: stop passing non-strings to Abort's constructor
Martin von Zweigbergk <martinvonz@google.com>
parents: 44856
diff changeset
    87
  >     raise error.Abort(b"simulated error while recording dirstateupdates")
22406
2e47e461d2ca dirstate: add test for exceptions during updates
Durham Goode <durham@fb.com>
parents: 19092
diff changeset
    88
  > 
2e47e461d2ca dirstate: add test for exceptions during updates
Durham Goode <durham@fb.com>
parents: 19092
diff changeset
    89
  > def reposetup(ui, repo):
44856
b7808443ed6a mergestate: split out merge state handling code from main merge module
Augie Fackler <augie@google.com>
parents: 42456
diff changeset
    90
  >     extensions.wrapfunction(mergestatemod, 'recordupdates',
b7808443ed6a mergestate: split out merge state handling code from main merge module
Augie Fackler <augie@google.com>
parents: 42456
diff changeset
    91
  >                             wraprecordupdates)
22406
2e47e461d2ca dirstate: add test for exceptions during updates
Durham Goode <durham@fb.com>
parents: 19092
diff changeset
    92
  > EOF
2e47e461d2ca dirstate: add test for exceptions during updates
Durham Goode <durham@fb.com>
parents: 19092
diff changeset
    93
2e47e461d2ca dirstate: add test for exceptions during updates
Durham Goode <durham@fb.com>
parents: 19092
diff changeset
    94
  $ hg rm a
2e47e461d2ca dirstate: add test for exceptions during updates
Durham Goode <durham@fb.com>
parents: 19092
diff changeset
    95
  $ hg commit -m 'rm a'
2e47e461d2ca dirstate: add test for exceptions during updates
Durham Goode <durham@fb.com>
parents: 19092
diff changeset
    96
  $ echo "[extensions]" >> .hg/hgrc
2e47e461d2ca dirstate: add test for exceptions during updates
Durham Goode <durham@fb.com>
parents: 19092
diff changeset
    97
  $ echo "dirstateex=../dirstateexception.py" >> .hg/hgrc
2e47e461d2ca dirstate: add test for exceptions during updates
Durham Goode <durham@fb.com>
parents: 19092
diff changeset
    98
  $ hg up 0
2e47e461d2ca dirstate: add test for exceptions during updates
Durham Goode <durham@fb.com>
parents: 19092
diff changeset
    99
  abort: simulated error while recording dirstateupdates
2e47e461d2ca dirstate: add test for exceptions during updates
Durham Goode <durham@fb.com>
parents: 19092
diff changeset
   100
  [255]
2e47e461d2ca dirstate: add test for exceptions during updates
Durham Goode <durham@fb.com>
parents: 19092
diff changeset
   101
  $ hg log -r . -T '{rev}\n'
2e47e461d2ca dirstate: add test for exceptions during updates
Durham Goode <durham@fb.com>
parents: 19092
diff changeset
   102
  1
2e47e461d2ca dirstate: add test for exceptions during updates
Durham Goode <durham@fb.com>
parents: 19092
diff changeset
   103
  $ hg status
2e47e461d2ca dirstate: add test for exceptions during updates
Durham Goode <durham@fb.com>
parents: 19092
diff changeset
   104
  ? a
48741
46d12f7762e4 dirstate-v2: fix infinite loop in pure packer
Raphaël Gomès <rgomes@octobus.net>
parents: 48674
diff changeset
   105
46d12f7762e4 dirstate-v2: fix infinite loop in pure packer
Raphaël Gomès <rgomes@octobus.net>
parents: 48674
diff changeset
   106
#if dirstate-v2
46d12f7762e4 dirstate-v2: fix infinite loop in pure packer
Raphaël Gomès <rgomes@octobus.net>
parents: 48674
diff changeset
   107
Check that folders that are prefixes of others do not throw the packer into an
46d12f7762e4 dirstate-v2: fix infinite loop in pure packer
Raphaël Gomès <rgomes@octobus.net>
parents: 48674
diff changeset
   108
infinite loop.
46d12f7762e4 dirstate-v2: fix infinite loop in pure packer
Raphaël Gomès <rgomes@octobus.net>
parents: 48674
diff changeset
   109
46d12f7762e4 dirstate-v2: fix infinite loop in pure packer
Raphaël Gomès <rgomes@octobus.net>
parents: 48674
diff changeset
   110
  $ cd ..
46d12f7762e4 dirstate-v2: fix infinite loop in pure packer
Raphaël Gomès <rgomes@octobus.net>
parents: 48674
diff changeset
   111
  $ hg init infinite-loop
46d12f7762e4 dirstate-v2: fix infinite loop in pure packer
Raphaël Gomès <rgomes@octobus.net>
parents: 48674
diff changeset
   112
  $ cd infinite-loop
46d12f7762e4 dirstate-v2: fix infinite loop in pure packer
Raphaël Gomès <rgomes@octobus.net>
parents: 48674
diff changeset
   113
  $ mkdir hgext3rd hgext
46d12f7762e4 dirstate-v2: fix infinite loop in pure packer
Raphaël Gomès <rgomes@octobus.net>
parents: 48674
diff changeset
   114
  $ touch hgext3rd/__init__.py hgext/zeroconf.py
46d12f7762e4 dirstate-v2: fix infinite loop in pure packer
Raphaël Gomès <rgomes@octobus.net>
parents: 48674
diff changeset
   115
  $ hg commit -Aqm0
46d12f7762e4 dirstate-v2: fix infinite loop in pure packer
Raphaël Gomès <rgomes@octobus.net>
parents: 48674
diff changeset
   116
46d12f7762e4 dirstate-v2: fix infinite loop in pure packer
Raphaël Gomès <rgomes@octobus.net>
parents: 48674
diff changeset
   117
  $ hg st -c
46d12f7762e4 dirstate-v2: fix infinite loop in pure packer
Raphaël Gomès <rgomes@octobus.net>
parents: 48674
diff changeset
   118
  C hgext/zeroconf.py
46d12f7762e4 dirstate-v2: fix infinite loop in pure packer
Raphaël Gomès <rgomes@octobus.net>
parents: 48674
diff changeset
   119
  C hgext3rd/__init__.py
46d12f7762e4 dirstate-v2: fix infinite loop in pure packer
Raphaël Gomès <rgomes@octobus.net>
parents: 48674
diff changeset
   120
46d12f7762e4 dirstate-v2: fix infinite loop in pure packer
Raphaël Gomès <rgomes@octobus.net>
parents: 48674
diff changeset
   121
  $ cd ..
49150
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   122
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   123
Check that the old dirstate data file is removed correctly and the new one is
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   124
valid.
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   125
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   126
  $ dirstate_data_files () {
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   127
  >   find .hg -maxdepth 1 -name "dirstate.*"
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   128
  > }
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   129
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   130
  $ find_dirstate_uuid () {
49154
51262af89efe test-dirstate: use new `--docket` flag to get the data uuid
Raphaël Gomès <rgomes@octobus.net>
parents: 49150
diff changeset
   131
  >   hg debugstate --docket | grep uuid | sed 's/.*uuid: \(.*\)/\1/'
49150
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   132
  > }
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   133
49201
c29e79d11b01 test-dirstate: actually test the append code path in dirstate v2
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 49158
diff changeset
   134
  $ find_dirstate_data_size () {
c29e79d11b01 test-dirstate: actually test the append code path in dirstate v2
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 49158
diff changeset
   135
  >   hg debugstate --docket | grep 'size of dirstate data' | sed 's/.*size of dirstate data: \(.*\)/\1/'
c29e79d11b01 test-dirstate: actually test the append code path in dirstate v2
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 49158
diff changeset
   136
  > }
c29e79d11b01 test-dirstate: actually test the append code path in dirstate v2
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 49158
diff changeset
   137
49150
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   138
  $ dirstate_uuid_has_not_changed () {
49157
5d610521a285 test-dirstate: fix detection of Rust environment variable
Raphaël Gomès <rgomes@octobus.net>
parents: 49156
diff changeset
   139
  >   # Non-Rust always rewrites the whole dirstate
5d610521a285 test-dirstate: fix detection of Rust environment variable
Raphaël Gomès <rgomes@octobus.net>
parents: 49156
diff changeset
   140
  >   if [ $# -eq 1 ] || ([ -n "$HGMODULEPOLICY" ] && [ -z "${HGMODULEPOLICY##*rust*}" ]) || [ -n "$RHG_INSTALLED_AS_HG" ]; then
49150
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   141
  >     test $current_uid = $(find_dirstate_uuid)
49158
682b0ac92c0b test-dirstate: print something when the check is skipped
Raphaël Gomès <rgomes@octobus.net>
parents: 49157
diff changeset
   142
  >   else
682b0ac92c0b test-dirstate: print something when the check is skipped
Raphaël Gomès <rgomes@octobus.net>
parents: 49157
diff changeset
   143
  >     echo "not testing because using Python implementation"
49150
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   144
  >   fi
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   145
  > }
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   146
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   147
  $ cd ..
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   148
  $ hg init append-mostly
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   149
  $ cd append-mostly
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   150
  $ mkdir dir dir2
50177
964a913343a2 test-dirstate: use more robust method to trigger a data-file append
Raphaël Gomès <rgomes@octobus.net>
parents: 49550
diff changeset
   151
  $ touch -t 200001010000 dir/a dir/b dir/c dir/d dir/e dir2/f dir dir2
49150
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   152
  $ hg commit -Aqm initial
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   153
  $ hg st
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   154
  $ dirstate_data_files | wc -l
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   155
   *1 (re)
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   156
  $ current_uid=$(find_dirstate_uuid)
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   157
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   158
Nothing changes here
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   159
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   160
  $ hg st
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   161
  $ dirstate_data_files | wc -l
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   162
   *1 (re)
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   163
  $ dirstate_uuid_has_not_changed
49158
682b0ac92c0b test-dirstate: print something when the check is skipped
Raphaël Gomès <rgomes@octobus.net>
parents: 49157
diff changeset
   164
  not testing because using Python implementation (no-rust no-rhg !)
49150
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   165
50177
964a913343a2 test-dirstate: use more robust method to trigger a data-file append
Raphaël Gomès <rgomes@octobus.net>
parents: 49550
diff changeset
   166
Trigger an append with a small change to directory mtime
49150
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   167
49201
c29e79d11b01 test-dirstate: actually test the append code path in dirstate v2
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 49158
diff changeset
   168
  $ current_data_size=$(find_dirstate_data_size)
50177
964a913343a2 test-dirstate: use more robust method to trigger a data-file append
Raphaël Gomès <rgomes@octobus.net>
parents: 49550
diff changeset
   169
  $ touch -t 201001010000 dir2
49150
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   170
  $ hg st
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   171
  $ dirstate_data_files | wc -l
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   172
   *1 (re)
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   173
  $ dirstate_uuid_has_not_changed
49158
682b0ac92c0b test-dirstate: print something when the check is skipped
Raphaël Gomès <rgomes@octobus.net>
parents: 49157
diff changeset
   174
  not testing because using Python implementation (no-rust no-rhg !)
49201
c29e79d11b01 test-dirstate: actually test the append code path in dirstate v2
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 49158
diff changeset
   175
  $ new_data_size=$(find_dirstate_data_size)
c29e79d11b01 test-dirstate: actually test the append code path in dirstate v2
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 49158
diff changeset
   176
  $ [ "$current_data_size" -eq "$new_data_size" ]; echo $?
c29e79d11b01 test-dirstate: actually test the append code path in dirstate v2
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 49158
diff changeset
   177
  0 (no-rust no-rhg !)
c29e79d11b01 test-dirstate: actually test the append code path in dirstate v2
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 49158
diff changeset
   178
  1 (rust !)
c29e79d11b01 test-dirstate: actually test the append code path in dirstate v2
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 49158
diff changeset
   179
  1 (no-rust rhg !)
49150
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   180
49155
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   181
Unused bytes counter is non-0 when appending
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   182
  $ touch file
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   183
  $ hg add file
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   184
  $ current_uid=$(find_dirstate_uuid)
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   185
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   186
Trigger a rust/rhg run which updates the unused bytes value
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   187
  $ hg st
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   188
  A file
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   189
  $ dirstate_data_files | wc -l
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   190
   *1 (re)
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   191
  $ dirstate_uuid_has_not_changed
49158
682b0ac92c0b test-dirstate: print something when the check is skipped
Raphaël Gomès <rgomes@octobus.net>
parents: 49157
diff changeset
   192
  not testing because using Python implementation (no-rust no-rhg !)
49155
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   193
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   194
  $ hg debugstate --docket | grep unused
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   195
  number of unused bytes: 0 (no-rust no-rhg !)
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   196
  number of unused bytes: [1-9]\d* (re) (rhg no-rust !)
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   197
  number of unused bytes: [1-9]\d* (re) (rust no-rhg !)
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   198
  number of unused bytes: [1-9]\d* (re) (rust rhg !)
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   199
49150
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   200
Delete most of the dirstate to trigger a non-append
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   201
  $ hg rm dir/a dir/b dir/c dir/d
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   202
  $ dirstate_data_files | wc -l
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   203
   *1 (re)
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   204
  $ dirstate_uuid_has_not_changed also-if-python
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   205
  [1]
f2ef6a4f918f rhg: fix dirstate-v2 data file removal system
Raphaël Gomès <rgomes@octobus.net>
parents: 48773
diff changeset
   206
49155
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   207
Check that unused bytes counter is reset when creating a new docket
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   208
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   209
  $ hg debugstate --docket | grep unused
49156
09984dc70352 rust-dirstate-v2: fix the unused bytes counter when rewriting the dirstate
Raphaël Gomès <rgomes@octobus.net>
parents: 49155
diff changeset
   210
  number of unused bytes: 0
49155
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   211
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   212
#endif
c69adc82e7f7 rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
Raphaël Gomès <rgomes@octobus.net>
parents: 49154
diff changeset
   213
50222
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   214
(non-Rust always rewrites)
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   215
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   216
Test the devel option to control write behavior
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   217
==============================================
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   218
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   219
Sometimes, debugging or testing the dirstate requires making sure that we have
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   220
done a complete rewrite of the data file and have no unreachable data around,
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   221
sometimes it requires we ensure we don't.
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   222
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   223
We test the option to force this rewrite by creating the situation where an
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   224
append would happen and check that it doesn't happen.
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   225
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   226
  $ cd ..
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   227
  $ hg init force-base
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   228
  $ cd force-base
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   229
  $ mkdir -p dir/nested dir2
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   230
  $ touch -t 200001010000 f dir/nested/a dir/b dir/c dir/d dir2/e dir/nested dir dir2
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   231
  $ hg commit -Aqm "recreate a bunch of files to facilitate append"
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   232
  $ hg st --config devel.dirstate.v2.data_update_mode=force-new
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   233
  $ cd ..
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   234
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   235
#if dirstate-v2
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   236
  $ hg -R force-base debugstate --docket | grep unused
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   237
  number of unused bytes: 0
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   238
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   239
Check with the option in "auto" mode
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   240
------------------------------------
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   241
  $ cp -a force-base append-mostly-no-force-rewrite
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   242
  $ cd append-mostly-no-force-rewrite
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   243
  $ current_uid=$(find_dirstate_uuid)
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   244
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   245
Change mtime of dir on disk which will be recorded, causing a small enough change
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   246
to warrant only an append
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   247
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   248
  $ touch -t 202212010000 dir2
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   249
  $ hg st \
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   250
  > --config rhg.on-unsupported=abort \
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   251
  > --config devel.dirstate.v2.data_update_mode=auto
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   252
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   253
UUID hasn't changed and a non-zero number of unused bytes means we've appended
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   254
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   255
  $ dirstate_uuid_has_not_changed
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   256
  not testing because using Python implementation (no-rust no-rhg !)
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   257
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   258
#if no-rust no-rhg
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   259
The pure python implementation never appends at the time this is written.
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   260
  $ hg debugstate --docket | grep unused
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   261
  number of unused bytes: 0 (known-bad-output !)
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   262
#else
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   263
  $ hg debugstate --docket | grep unused
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   264
  number of unused bytes: [1-9]\d* (re)
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   265
#endif
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   266
  $ cd ..
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   267
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   268
Check the same scenario with the option set to "force-new"
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   269
---------------------------------------------------------
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   270
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   271
  $ cp -a force-base append-mostly-force-rewrite
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   272
  $ cd append-mostly-force-rewrite
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   273
  $ current_uid=$(find_dirstate_uuid)
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   274
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   275
Change mtime of dir on disk which will be recorded, causing a small enough change
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   276
to warrant only an append, but we force the rewrite
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   277
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   278
  $ touch -t 202212010000 dir2
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   279
  $ hg st \
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   280
  > --config rhg.on-unsupported=abort \
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   281
  > --config devel.dirstate.v2.data_update_mode=force-new
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   282
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   283
UUID has changed and zero unused bytes means a full-rewrite happened
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   284
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   285
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   286
#if no-rust no-rhg
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   287
  $ dirstate_uuid_has_not_changed
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   288
  not testing because using Python implementation
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   289
#else
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   290
  $ dirstate_uuid_has_not_changed
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   291
  [1]
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   292
#endif
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   293
  $ hg debugstate --docket | grep unused
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   294
  number of unused bytes: 0
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   295
  $ cd ..
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   296
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   297
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   298
Check the same scenario with the option set to "force-append"
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   299
-------------------------------------------------------------
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   300
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   301
(should behave the same as "auto" here)
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   302
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   303
  $ cp -a force-base append-mostly-force-append
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   304
  $ cd append-mostly-force-append
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   305
  $ current_uid=$(find_dirstate_uuid)
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   306
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   307
Change mtime of dir on disk which will be recorded, causing a small enough change
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   308
to warrant only an append, which we are forcing here anyway.
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   309
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   310
  $ touch -t 202212010000 dir2
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   311
  $ hg st \
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   312
  > --config rhg.on-unsupported=abort \
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   313
  > --config devel.dirstate.v2.data_update_mode=force-append
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   314
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   315
UUID has not changed and some unused bytes exist in the data file
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   316
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   317
  $ dirstate_uuid_has_not_changed
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   318
  not testing because using Python implementation (no-rust no-rhg !)
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   319
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   320
#if no-rust no-rhg
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   321
The pure python implementation never appends at the time this is written.
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   322
  $ hg debugstate --docket | grep unused
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   323
  number of unused bytes: 0 (known-bad-output !)
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   324
#else
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   325
  $ hg debugstate --docket | grep unused
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   326
  number of unused bytes: [1-9]\d* (re)
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   327
#endif
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   328
  $ cd ..
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   329
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   330
Check with the option in "auto" mode
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   331
------------------------------------
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   332
  $ cp -a force-base append-mostly-no-force-rewrite
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   333
  $ cd append-mostly-no-force-rewrite
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   334
  $ current_uid=$(find_dirstate_uuid)
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   335
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   336
Change mtime of everything on disk causing a full rewrite
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   337
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   338
  $ touch -t 202212010005 `hg files`
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   339
  $ hg st \
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   340
  > --config rhg.on-unsupported=abort \
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   341
  > --config devel.dirstate.v2.data_update_mode=auto
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   342
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   343
UUID has changed and zero unused bytes means we've rewritten.
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   344
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   345
#if no-rust no-rhg
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   346
  $ dirstate_uuid_has_not_changed
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   347
  not testing because using Python implementation
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   348
#else
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   349
  $ dirstate_uuid_has_not_changed
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   350
  [1]
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   351
#endif
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   352
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   353
  $ hg debugstate --docket | grep unused
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   354
  number of unused bytes: 0 (known-bad-output !)
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   355
  $ cd ..
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   356
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   357
Check the same scenario with the option set to "force-new"
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   358
---------------------------------------------------------
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   359
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   360
(should be the same as auto)
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   361
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   362
  $ cp -a force-base append-mostly-force-rewrite
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   363
  $ cd append-mostly-force-rewrite
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   364
  $ current_uid=$(find_dirstate_uuid)
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   365
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   366
Change mtime of everything on disk causing a full rewrite
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   367
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   368
  $ touch -t 202212010005 `hg files`
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   369
  $ hg st \
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   370
  > --config rhg.on-unsupported=abort \
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   371
  > --config devel.dirstate.v2.data_update_mode=force-new
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   372
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   373
UUID has changed and a zero number unused bytes means we've rewritten.
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   374
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   375
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   376
#if no-rust no-rhg
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   377
  $ dirstate_uuid_has_not_changed
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   378
  not testing because using Python implementation
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   379
#else
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   380
  $ dirstate_uuid_has_not_changed
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   381
  [1]
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   382
#endif
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   383
  $ hg debugstate --docket | grep unused
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   384
  number of unused bytes: 0
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   385
  $ cd ..
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   386
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   387
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   388
Check the same scenario with the option set to "force-append"
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   389
-------------------------------------------------------------
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   390
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   391
Should append even if "auto" did not
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   392
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   393
  $ cp -a force-base append-mostly-force-append
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   394
  $ cd append-mostly-force-append
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   395
  $ current_uid=$(find_dirstate_uuid)
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   396
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   397
Change mtime of everything on disk causing a full rewrite
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   398
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   399
  $ touch -t 202212010005 `hg files`
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   400
  $ hg st \
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   401
  > --config rhg.on-unsupported=abort \
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   402
  > --config devel.dirstate.v2.data_update_mode=force-append
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   403
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   404
UUID has not changed and some unused bytes exist in the data file
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   405
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   406
  $ dirstate_uuid_has_not_changed
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   407
  not testing because using Python implementation (no-rust no-rhg !)
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   408
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   409
#if no-rust no-rhg
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   410
The pure python implementation is never appending at the time this is written.
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   411
  $ hg debugstate --docket | grep unused
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   412
  number of unused bytes: 0 (known-bad-output !)
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   413
#else
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   414
  $ hg debugstate --docket | grep unused
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   415
  number of unused bytes: [1-9]\d* (re)
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   416
#endif
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   417
  $ cd ..
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   418
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   419
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   420
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   421
Get back into a state suitable for the test of the file.
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   422
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   423
  $ cd ./append-mostly
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   424
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   425
#else
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   426
  $ cd ./u
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   427
#endif
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   428
49466
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   429
Transaction compatibility
50222
ecd28d89c29e dirstate-v2: add devel config option to control write behavior
Raphaël Gomès <rgomes@octobus.net>
parents: 50177
diff changeset
   430
=========================
49466
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   431
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   432
The transaction preserves the dirstate.
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   433
We should make sure all of it (docket + data) is preserved
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   434
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   435
#if dirstate-v2
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   436
  $ hg commit -m 'bli'
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   437
#endif
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   438
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   439
  $ hg update --quiet
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   440
  $ hg revert --all --quiet
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   441
  $ rm -f a
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   442
  $ echo foo > foo
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   443
  $ hg add foo
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   444
  $ hg commit -m foo
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   445
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   446
#if dirstate-v2
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   447
  $ uid=$(find_dirstate_uuid)
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   448
  $ touch bar
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   449
  $ while [ uid = $(find_dirstate_uuid) ]; do
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   450
  >    hg add bar;
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   451
  >    hg remove bar;
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   452
  > done;
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   453
  $ rm bar
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   454
#endif
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   455
  $ hg rollback
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   456
  repository tip rolled back to revision 1 (undo commit)
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   457
  working directory now based on revision 1
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   458
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   459
  $ hg status
486b8a383100 dirstate-v2: display a possible issue with transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49465
diff changeset
   460
  A foo
49549
e255a5355971 dirstate-v2: highlight a bug when Python-packed but used in `rhg`
Raphaël Gomès <rgomes@octobus.net>
parents: 49467
diff changeset
   461
  $ cd ..
e255a5355971 dirstate-v2: highlight a bug when Python-packed but used in `rhg`
Raphaël Gomès <rgomes@octobus.net>
parents: 49467
diff changeset
   462
e255a5355971 dirstate-v2: highlight a bug when Python-packed but used in `rhg`
Raphaël Gomès <rgomes@octobus.net>
parents: 49467
diff changeset
   463
Check dirstate ordering
e255a5355971 dirstate-v2: highlight a bug when Python-packed but used in `rhg`
Raphaël Gomès <rgomes@octobus.net>
parents: 49467
diff changeset
   464
(e.g. `src/dirstate/` and `src/dirstate.rs` shouldn't cause issues)
e255a5355971 dirstate-v2: highlight a bug when Python-packed but used in `rhg`
Raphaël Gomès <rgomes@octobus.net>
parents: 49467
diff changeset
   465
e255a5355971 dirstate-v2: highlight a bug when Python-packed but used in `rhg`
Raphaël Gomès <rgomes@octobus.net>
parents: 49467
diff changeset
   466
  $ hg init repro
e255a5355971 dirstate-v2: highlight a bug when Python-packed but used in `rhg`
Raphaël Gomès <rgomes@octobus.net>
parents: 49467
diff changeset
   467
  $ cd repro
e255a5355971 dirstate-v2: highlight a bug when Python-packed but used in `rhg`
Raphaël Gomès <rgomes@octobus.net>
parents: 49467
diff changeset
   468
  $ mkdir src
e255a5355971 dirstate-v2: highlight a bug when Python-packed but used in `rhg`
Raphaël Gomès <rgomes@octobus.net>
parents: 49467
diff changeset
   469
  $ mkdir src/dirstate
e255a5355971 dirstate-v2: highlight a bug when Python-packed but used in `rhg`
Raphaël Gomès <rgomes@octobus.net>
parents: 49467
diff changeset
   470
  $ touch src/dirstate/file1 src/dirstate/file2 src/dirstate.rs
e255a5355971 dirstate-v2: highlight a bug when Python-packed but used in `rhg`
Raphaël Gomès <rgomes@octobus.net>
parents: 49467
diff changeset
   471
  $ touch file1 file2
e255a5355971 dirstate-v2: highlight a bug when Python-packed but used in `rhg`
Raphaël Gomès <rgomes@octobus.net>
parents: 49467
diff changeset
   472
  $ hg commit -Aqm1
e255a5355971 dirstate-v2: highlight a bug when Python-packed but used in `rhg`
Raphaël Gomès <rgomes@octobus.net>
parents: 49467
diff changeset
   473
  $ hg st
e255a5355971 dirstate-v2: highlight a bug when Python-packed but used in `rhg`
Raphaël Gomès <rgomes@octobus.net>
parents: 49467
diff changeset
   474
  $ cd ..