tests/test-sparse-requirement.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Thu, 04 Jan 2024 14:51:48 +0100
changeset 51339 9a1239c362ae
parent 48669 7ee07e1a25c0
permissions -rw-r--r--
delta-find: split the "sparse" part of `_pre_filter_rev` in a method Since `_pre_filter_rev` contains logic from various sources of constraint, we start splitting is in subfunction to clarify and document the grouping.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33556
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     1
  $ hg init repo
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     2
  $ cd repo
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     3
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     4
  $ touch a.html b.html c.py d.py
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     5
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     6
  $ cat > frontend.sparse << EOF
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     7
  > [include]
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     8
  > *.html
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     9
  > EOF
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    10
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    11
  $ hg -q commit -A -m initial
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    12
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    13
  $ echo 1 > a.html
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    14
  $ echo 1 > c.py
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    15
  $ hg commit -m 'commit 1'
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    16
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    17
Enable sparse profile
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    18
48464
5e6542143d40 test: use `hg debugrequires` instead of `cat` in some tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48321
diff changeset
    19
  $ hg debugrequires
33556
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    20
  dotencode
48321
f35529784079 dirstate-v2: fix confusion between requirement and format config variable
Raphaël Gomès <rgomes@octobus.net>
parents: 48295
diff changeset
    21
  dirstate-v2 (dirstate-v2 !)
33556
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    22
  fncache
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    23
  generaldelta
46884
cc3ad5c3af3b persistent-nodemap: enable the feature by default when using Rust
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46874
diff changeset
    24
  persistent-nodemap (rust !)
46874
84a93fa7ecfd revlog-compression: use zstd by default (if available)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
    25
  revlog-compression-zstd (zstd !)
33556
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    26
  revlogv1
48669
7ee07e1a25c0 share-safe: enable by default (BC)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48464
diff changeset
    27
  share-safe
40907
74a519c86625 test: enable sparse-revlog for test-sparse-requirement.t
Boris Feld <boris.feld@octobus.net>
parents: 37415
diff changeset
    28
  sparserevlog
33556
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    29
  store
37415
c2c8962a9465 simplestore: use a custom store for the simple store repo
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33556
diff changeset
    30
  testonly-simplestore (reposimplestore !)
33556
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    31
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    32
  $ hg debugsparse --config extensions.sparse= --enable-profile frontend.sparse
44724
5c2a4f37eace tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents: 40919
diff changeset
    33
  $ ls -A
5c2a4f37eace tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents: 40919
diff changeset
    34
  .hg
33556
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    35
  a.html
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    36
  b.html
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    37
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    38
Requirement for sparse added when sparse is enabled
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    39
48464
5e6542143d40 test: use `hg debugrequires` instead of `cat` in some tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48321
diff changeset
    40
  $ hg debugrequires --config extensions.sparse=
33556
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    41
  dotencode
48321
f35529784079 dirstate-v2: fix confusion between requirement and format config variable
Raphaël Gomès <rgomes@octobus.net>
parents: 48295
diff changeset
    42
  dirstate-v2 (dirstate-v2 !)
33556
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    43
  exp-sparse
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    44
  fncache
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    45
  generaldelta
46884
cc3ad5c3af3b persistent-nodemap: enable the feature by default when using Rust
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46874
diff changeset
    46
  persistent-nodemap (rust !)
46874
84a93fa7ecfd revlog-compression: use zstd by default (if available)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
    47
  revlog-compression-zstd (zstd !)
33556
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    48
  revlogv1
48669
7ee07e1a25c0 share-safe: enable by default (BC)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48464
diff changeset
    49
  share-safe
40907
74a519c86625 test: enable sparse-revlog for test-sparse-requirement.t
Boris Feld <boris.feld@octobus.net>
parents: 37415
diff changeset
    50
  sparserevlog
33556
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    51
  store
37415
c2c8962a9465 simplestore: use a custom store for the simple store repo
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33556
diff changeset
    52
  testonly-simplestore (reposimplestore !)
33556
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    53
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    54
Client without sparse enabled reacts properly
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    55
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    56
  $ hg files
45906
95c4cca641f6 errors: remove trailing "!" from some error messages for consistency
Martin von Zweigbergk <martinvonz@google.com>
parents: 44724
diff changeset
    57
  abort: repository is using sparse feature but sparse is not enabled; enable the "sparse" extensions to access
33556
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    58
  [255]
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    59
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    60
Requirement for sparse is removed when sparse is disabled
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    61
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    62
  $ hg debugsparse --reset --config extensions.sparse=
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    63
48464
5e6542143d40 test: use `hg debugrequires` instead of `cat` in some tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48321
diff changeset
    64
  $ hg debugrequires
33556
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    65
  dotencode
48321
f35529784079 dirstate-v2: fix confusion between requirement and format config variable
Raphaël Gomès <rgomes@octobus.net>
parents: 48295
diff changeset
    66
  dirstate-v2 (dirstate-v2 !)
33556
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    67
  fncache
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    68
  generaldelta
46884
cc3ad5c3af3b persistent-nodemap: enable the feature by default when using Rust
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46874
diff changeset
    69
  persistent-nodemap (rust !)
46874
84a93fa7ecfd revlog-compression: use zstd by default (if available)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
    70
  revlog-compression-zstd (zstd !)
33556
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    71
  revlogv1
48669
7ee07e1a25c0 share-safe: enable by default (BC)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48464
diff changeset
    72
  share-safe
40907
74a519c86625 test: enable sparse-revlog for test-sparse-requirement.t
Boris Feld <boris.feld@octobus.net>
parents: 37415
diff changeset
    73
  sparserevlog
33556
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    74
  store
37415
c2c8962a9465 simplestore: use a custom store for the simple store repo
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33556
diff changeset
    75
  testonly-simplestore (reposimplestore !)
33556
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    76
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    77
And client without sparse can access
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    78
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    79
  $ hg files
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    80
  a.html
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    81
  b.html
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    82
  c.py
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    83
  d.py
22371eabb3b1 sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    84
  frontend.sparse