tests/test-sidedata.t
author Gregory Szorc <gregory.szorc@gmail.com>
Sat, 05 Oct 2019 16:57:45 -0400
changeset 43068 094d0f4a8edd
parent 43041 559ac8411f12
child 43134 75ad8af9c95e
permissions -rw-r--r--
tests: allow xrange warning from perf.py The use of xrange in this file is acceptable. We need to make the output optional - and not conditional on the Python version - because `pyflakes` could be executed by any Python version and pyflakes behaves differently depending on the Python version. Differential Revision: https://phab.mercurial-scm.org/D6990
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
ba4072c0a911 sidedata: test we can successfully write sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43031
diff changeset
    13
  $ hg init test-sidedata --config format.use-side-data=yes
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
43031
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    43
Check upgrade behavior
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    44
======================
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    45
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    46
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
    47
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    48
Check that we cannot upgrade to sidedata
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    49
----------------------------------------
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    50
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    51
  $ hg init up-no-side-data --config format.use-side-data=no
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    52
  $ hg debugformat -v -R up-no-side-data
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    53
  format-variant    repo config default
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    54
  fncache:           yes    yes     yes
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    55
  dotencode:         yes    yes     yes
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    56
  generaldelta:      yes    yes     yes
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    57
  sparserevlog:      yes    yes     yes
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    58
  sidedata:           no     no      no
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    59
  plain-cl-delta:    yes    yes     yes
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    60
  compression:       zlib   zlib    zlib
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    61
  compression-level: default default default
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    62
  $ hg debugformat -v -R up-no-side-data --config format.use-side-data=yes
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    63
  format-variant    repo config default
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    64
  fncache:           yes    yes     yes
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    65
  dotencode:         yes    yes     yes
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    66
  generaldelta:      yes    yes     yes
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    67
  sparserevlog:      yes    yes     yes
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    68
  sidedata:           no    yes      no
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    69
  plain-cl-delta:    yes    yes     yes
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    70
  compression:       zlib   zlib    zlib
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    71
  compression-level: default default default
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    72
  $ hg debugupgraderepo -R up-no-side-data --config format.use-side-data=yes
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    73
  abort: cannot upgrade repository; do not support adding requirement: exp-sidedata-flag
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    74
  [255]
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    75
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    76
Check that we cannot upgrade to sidedata
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    77
----------------------------------------
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    78
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    79
  $ hg init up-side-data --config format.use-side-data=yes
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    80
  $ hg debugformat -v -R up-side-data
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    81
  format-variant    repo config default
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    82
  fncache:           yes    yes     yes
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    83
  dotencode:         yes    yes     yes
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    84
  generaldelta:      yes    yes     yes
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    85
  sparserevlog:      yes    yes     yes
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    86
  sidedata:          yes     no      no
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    87
  plain-cl-delta:    yes    yes     yes
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    88
  compression:       zlib   zlib    zlib
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    89
  compression-level: default default default
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    90
  $ hg debugformat -v -R up-side-data --config format.use-side-data=no
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    91
  format-variant    repo config default
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    92
  fncache:           yes    yes     yes
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    93
  dotencode:         yes    yes     yes
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    94
  generaldelta:      yes    yes     yes
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    95
  sparserevlog:      yes    yes     yes
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    96
  sidedata:          yes     no      no
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    97
  plain-cl-delta:    yes    yes     yes
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    98
  compression:       zlib   zlib    zlib
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    99
  compression-level: default default default
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   100
  $ hg debugupgraderepo -R up-side-data --config format.use-side-data=no
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   101
  abort: cannot upgrade repository; requirement would be removed: exp-sidedata-flag
e16ca9fde7aa upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   102
  [255]