tests/test-sidedata.t
author Matt Harbison <matt_harbison@yahoo.com>
Wed, 14 Dec 2022 01:38:52 -0500
changeset 49802 f3f33980f19b
parent 49266 da3e37ecacde
child 50725 7e5be4a7cda7
permissions -rw-r--r--
pycompat: explicitly prefix builtin attr usage with `builtins.` It doesn't seem like this would fix any bug, because the wrapped functions that take bytes instead of str are defined after these calls. But PyCharm was flagging the second and third uses, saying "Type 'str' doesn't have expected attribute 'decode'". It wasn't flagging the first, but I changed it for consistency.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
43031
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     1
==========================================================
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     2
Test file dedicated to checking side-data related behavior
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     3
==========================================================
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     4
43040
ba4072c0a911 sidedata: test we can successfully write sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43031
diff changeset
     5
Check data can be written/read from sidedata
ba4072c0a911 sidedata: test we can successfully write sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43031
diff changeset
     6
============================================
ba4072c0a911 sidedata: test we can successfully write sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43031
diff changeset
     7
ba4072c0a911 sidedata: test we can successfully write sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43031
diff changeset
     8
  $ cat << EOF >> $HGRCPATH
ba4072c0a911 sidedata: test we can successfully write sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43031
diff changeset
     9
  > [extensions]
ba4072c0a911 sidedata: test we can successfully write sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43031
diff changeset
    10
  > testsidedata=$TESTDIR/testlib/ext-sidedata.py
ba4072c0a911 sidedata: test we can successfully write sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43031
diff changeset
    11
  > EOF
ba4072c0a911 sidedata: test we can successfully write sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43031
diff changeset
    12
47227
0dedd3d063b0 test: no longer directly use the sidedata config and requirements
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46884
diff changeset
    13
  $ hg init test-sidedata --config experimental.revlogv2=enable-unstable-format-and-corrupt-my-data
43040
ba4072c0a911 sidedata: test we can successfully write sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43031
diff changeset
    14
  $ cd test-sidedata
ba4072c0a911 sidedata: test we can successfully write sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43031
diff changeset
    15
  $ echo aaa > a
ba4072c0a911 sidedata: test we can successfully write sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43031
diff changeset
    16
  $ hg add a
ba4072c0a911 sidedata: test we can successfully write sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43031
diff changeset
    17
  $ hg commit -m a --traceback
ba4072c0a911 sidedata: test we can successfully write sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43031
diff changeset
    18
  $ echo aaa > b
ba4072c0a911 sidedata: test we can successfully write sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43031
diff changeset
    19
  $ hg add b
ba4072c0a911 sidedata: test we can successfully write sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43031
diff changeset
    20
  $ hg commit -m b
ba4072c0a911 sidedata: test we can successfully write sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43031
diff changeset
    21
  $ echo xxx >> a
ba4072c0a911 sidedata: test we can successfully write sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43031
diff changeset
    22
  $ hg commit -m aa
43031
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    23
43041
559ac8411f12 sidedata: add a debugsidedata command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43040
diff changeset
    24
  $ hg debugsidedata -c 0
559ac8411f12 sidedata: add a debugsidedata command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43040
diff changeset
    25
  2 sidedata entries
559ac8411f12 sidedata: add a debugsidedata command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43040
diff changeset
    26
   entry-0001 size 4
559ac8411f12 sidedata: add a debugsidedata command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43040
diff changeset
    27
   entry-0002 size 32
559ac8411f12 sidedata: add a debugsidedata command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43040
diff changeset
    28
  $ hg debugsidedata -c 1 -v
559ac8411f12 sidedata: add a debugsidedata command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43040
diff changeset
    29
  2 sidedata entries
559ac8411f12 sidedata: add a debugsidedata command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43040
diff changeset
    30
   entry-0001 size 4
559ac8411f12 sidedata: add a debugsidedata command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43040
diff changeset
    31
    '\x00\x00\x006'
559ac8411f12 sidedata: add a debugsidedata command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43040
diff changeset
    32
   entry-0002 size 32
559ac8411f12 sidedata: add a debugsidedata command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43040
diff changeset
    33
    '\x98\t\xf9\xc4v\xf0\xc5P\x90\xf7wRf\xe8\xe27e\xfc\xc1\x93\xa4\x96\xd0\x1d\x97\xaaG\x1d\xd7t\xfa\xde'
559ac8411f12 sidedata: add a debugsidedata command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43040
diff changeset
    34
  $ hg debugsidedata -m 2
559ac8411f12 sidedata: add a debugsidedata command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43040
diff changeset
    35
  2 sidedata entries
559ac8411f12 sidedata: add a debugsidedata command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43040
diff changeset
    36
   entry-0001 size 4
559ac8411f12 sidedata: add a debugsidedata command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43040
diff changeset
    37
   entry-0002 size 32
559ac8411f12 sidedata: add a debugsidedata command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43040
diff changeset
    38
  $ hg debugsidedata a  1
559ac8411f12 sidedata: add a debugsidedata command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43040
diff changeset
    39
  2 sidedata entries
559ac8411f12 sidedata: add a debugsidedata command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43040
diff changeset
    40
   entry-0001 size 4
559ac8411f12 sidedata: add a debugsidedata command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43040
diff changeset
    41
   entry-0002 size 32
559ac8411f12 sidedata: add a debugsidedata command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43040
diff changeset
    42
49254
69983adfed06 debugindex: introduce a concept of "verbose-only" column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents: 48660
diff changeset
    43
  $ hg debug-revlog-index --verbose -c
49266
da3e37ecacde debugindex: add a `rank` column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents: 49265
diff changeset
    44
     rev   rank linkrev       nodeid p1-rev    p1-nodeid p2-rev    p2-nodeid            full-size delta-base flags comp-mode          data-offset chunk-size sd-comp-mode      sidedata-offset sd-chunk-size
da3e37ecacde debugindex: add a `rank` column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents: 49265
diff changeset
    45
       0     -1       0 7049e48789d7     -1 000000000000     -1 000000000000                   54          0     0         0                    0         54        plain                    0            90
da3e37ecacde debugindex: add a `rank` column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents: 49265
diff changeset
    46
       1     -1       1 2707720c6597      0 7049e48789d7     -1 000000000000                   54          1     0         0                   54         54        plain                   90            90
da3e37ecacde debugindex: add a `rank` column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents: 49265
diff changeset
    47
       2     -1       2 40f977031323      1 2707720c6597     -1 000000000000                   55          2     0         0                  108         55        plain                  180            90
49254
69983adfed06 debugindex: introduce a concept of "verbose-only" column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents: 48660
diff changeset
    48
69983adfed06 debugindex: introduce a concept of "verbose-only" column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents: 48660
diff changeset
    49
  $ hg debug-revlog-index --verbose -m
49266
da3e37ecacde debugindex: add a `rank` column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents: 49265
diff changeset
    50
     rev   rank linkrev       nodeid p1-rev    p1-nodeid p2-rev    p2-nodeid            full-size delta-base flags comp-mode          data-offset chunk-size sd-comp-mode      sidedata-offset sd-chunk-size
da3e37ecacde debugindex: add a `rank` column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents: 49265
diff changeset
    51
       0     -1       0 b85d294330e3     -1 000000000000     -1 000000000000                   43          0     0         0                    0         43        plain                    0            90
da3e37ecacde debugindex: add a `rank` column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents: 49265
diff changeset
    52
       1     -1       1 1a0aec305c63      0 b85d294330e3     -1 000000000000                   86          0     0         0                   43         55        plain                   90            90
da3e37ecacde debugindex: add a `rank` column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents: 49265
diff changeset
    53
       2     -1       2 104258a4f75f      1 1a0aec305c63     -1 000000000000                   86          1     0         0                   98         55        plain                  180            90
49254
69983adfed06 debugindex: introduce a concept of "verbose-only" column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents: 48660
diff changeset
    54
43031
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    55
Check upgrade behavior
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    56
======================
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    57
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    58
Right now, sidedata has not upgrade support
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    59
43134
75ad8af9c95e upgrade: allow upgrade to repository using sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43041
diff changeset
    60
Check that we can upgrade to sidedata
75ad8af9c95e upgrade: allow upgrade to repository using sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43041
diff changeset
    61
-------------------------------------
43031
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    62
47227
0dedd3d063b0 test: no longer directly use the sidedata config and requirements
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46884
diff changeset
    63
  $ hg init up-no-side-data --config experimental.revlogv2=no
48660
ddd5eecc6d0d test: simpler requirements matching in test-sidedata.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47320
diff changeset
    64
  $ hg debugformat -v -R up-no-side-data | egrep 'changelog-v2|revlog-v2'
46705
fd55a9eb1507 revlogv2: allow upgrading to v2
Raphaël Gomès <rgomes@octobus.net>
parents: 46334
diff changeset
    65
  revlog-v2:           no     no      no
47263
6c84fc9c9a90 changelogv2: introduce a "changelogv2" feature
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47227
diff changeset
    66
  changelog-v2:        no     no      no
48660
ddd5eecc6d0d test: simpler requirements matching in test-sidedata.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47320
diff changeset
    67
  $ hg debugformat -v -R up-no-side-data --config experimental.revlogv2=enable-unstable-format-and-corrupt-my-data | egrep 'changelog-v2|revlog-v2'
46705
fd55a9eb1507 revlogv2: allow upgrading to v2
Raphaël Gomès <rgomes@octobus.net>
parents: 46334
diff changeset
    68
  revlog-v2:           no    yes      no
47263
6c84fc9c9a90 changelogv2: introduce a "changelogv2" feature
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47227
diff changeset
    69
  changelog-v2:        no     no      no
47227
0dedd3d063b0 test: no longer directly use the sidedata config and requirements
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46884
diff changeset
    70
  $ hg debugupgraderepo -R up-no-side-data --config experimental.revlogv2=enable-unstable-format-and-corrupt-my-data > /dev/null
43031
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    71
43135
6e3dc1eff5c7 upgrade: allow for `sidedata` removal
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43134
diff changeset
    72
Check that we can downgrade from sidedata
6e3dc1eff5c7 upgrade: allow for `sidedata` removal
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43134
diff changeset
    73
-----------------------------------------
43031
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    74
47227
0dedd3d063b0 test: no longer directly use the sidedata config and requirements
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46884
diff changeset
    75
  $ hg init up-side-data --config experimental.revlogv2=enable-unstable-format-and-corrupt-my-data
48660
ddd5eecc6d0d test: simpler requirements matching in test-sidedata.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47320
diff changeset
    76
  $ hg debugformat -v -R up-side-data | egrep 'changelog-v2|revlog-v2'
46705
fd55a9eb1507 revlogv2: allow upgrading to v2
Raphaël Gomès <rgomes@octobus.net>
parents: 46334
diff changeset
    77
  revlog-v2:          yes     no      no
47263
6c84fc9c9a90 changelogv2: introduce a "changelogv2" feature
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47227
diff changeset
    78
  changelog-v2:        no     no      no
48660
ddd5eecc6d0d test: simpler requirements matching in test-sidedata.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47320
diff changeset
    79
  $ hg debugformat -v -R up-side-data --config experimental.revlogv2=no | egrep 'changelog-v2|revlog-v2'
46705
fd55a9eb1507 revlogv2: allow upgrading to v2
Raphaël Gomès <rgomes@octobus.net>
parents: 46334
diff changeset
    80
  revlog-v2:          yes     no      no
47263
6c84fc9c9a90 changelogv2: introduce a "changelogv2" feature
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47227
diff changeset
    81
  changelog-v2:        no     no      no
47227
0dedd3d063b0 test: no longer directly use the sidedata config and requirements
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46884
diff changeset
    82
  $ hg debugupgraderepo -R up-side-data --config experimental.revlogv2=no > /dev/null