tests/test-remotefilelog-sparse.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Tue, 06 Apr 2021 18:55:19 +0200
changeset 46874 84a93fa7ecfd
parent 46847 47a9527731c3
child 51181 dcaa2df1f688
permissions -rw-r--r--
revlog-compression: use zstd by default (if available) As see in changeset bb271ec2fbfb, zstd is 20% to 50% faster for reading and writing. Use take advantage of the new config behavior to try zstd by default, falling back to zlib is zstd is not available on that plateform. Differential Revision: https://phab.mercurial-scm.org/D10326
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
40722
0800d9e6e216 tests: disable remotefilelog on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 40572
diff changeset
     1
#require no-windows
0800d9e6e216 tests: disable remotefilelog on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 40572
diff changeset
     2
40495
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
     3
  $ . "$TESTDIR/remotefilelog-library.sh"
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
     4
40571
95a079ea1e19 tests: drop obsolete "hginit" alias in remotefilelog tests
Martin von Zweigbergk <martinvonz@google.com>
parents: 40495
diff changeset
     5
  $ hg init master
40495
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
     6
  $ cd master
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
     7
  $ cat >> .hg/hgrc <<EOF
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
     8
  > [remotefilelog]
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
     9
  > server=True
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    10
  > EOF
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    11
  $ echo x > x
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    12
  $ echo z > z
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    13
  $ hg commit -qAm x1
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    14
  $ echo x2 > x
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    15
  $ echo z2 > z
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    16
  $ hg commit -qAm x2
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    17
  $ hg bookmark foo
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    18
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    19
  $ cd ..
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    20
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    21
# prefetch a revision w/ a sparse checkout
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    22
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    23
  $ hgcloneshallow ssh://user@dummy/master shallow --noupdate
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    24
  streaming all changes
46874
84a93fa7ecfd revlog-compression: use zstd by default (if available)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46847
diff changeset
    25
  2 files to transfer, 527 bytes of data (no-zstd !)
84a93fa7ecfd revlog-compression: use zstd by default (if available)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46847
diff changeset
    26
  transferred 527 bytes in * seconds (* */sec) (glob) (no-zstd !)
84a93fa7ecfd revlog-compression: use zstd by default (if available)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46847
diff changeset
    27
  2 files to transfer, 534 bytes of data (zstd !)
84a93fa7ecfd revlog-compression: use zstd by default (if available)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46847
diff changeset
    28
  transferred 534 bytes in * seconds (* */sec) (glob) (zstd !)
40495
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    29
  searching for changes
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    30
  no changes found
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    31
  $ cd shallow
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    32
  $ printf "[extensions]\nsparse=\n" >> .hg/hgrc
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    33
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    34
  $ hg debugsparse -I x
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    35
  $ hg prefetch -r 0
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    36
  1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    37
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    38
  $ hg cat -r 0 x
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    39
  x
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    40
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    41
  $ hg debugsparse -I z
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    42
  $ hg prefetch -r 0
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    43
  1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    44
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    45
  $ hg cat -r 0 z
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    46
  z
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    47
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    48
# prefetch sparse only on pull when configured
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    49
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    50
  $ printf "[remotefilelog]\npullprefetch=bookmark()\n" >> .hg/hgrc
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    51
  $ hg strip tip
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    52
  saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/876b1317060d-b2e91d8d-backup.hg (glob)
46847
47a9527731c3 remotefilelog: include file contents in bundles produced during strip
Kyle Lippincott <spectral@google.com>
parents: 45771
diff changeset
    53
  2 files fetched over 2 fetches - (2 misses, 0.00% hit ratio) over *s (glob)
40495
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    54
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    55
  $ hg debugsparse --delete z
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    56
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    57
  $ clearcache
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    58
  $ hg pull
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    59
  pulling from ssh://user@dummy/master
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    60
  searching for changes
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    61
  adding changesets
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    62
  adding manifests
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    63
  adding file changes
42897
d7304434390f changegroup: move message about added changes to transaction summary
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42223
diff changeset
    64
  updating bookmark foo
40495
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    65
  added 1 changesets with 0 changes to 0 files
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    66
  new changesets 876b1317060d
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    67
  (run 'hg update' to get a working copy)
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    68
  prefetching file contents
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    69
  1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    70
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    71
# Dont consider filtered files when doing copy tracing
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    72
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    73
## Push an unrelated commit
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    74
  $ cd ../
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    75
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    76
  $ hgcloneshallow ssh://user@dummy/master shallow2
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    77
  streaming all changes
46874
84a93fa7ecfd revlog-compression: use zstd by default (if available)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46847
diff changeset
    78
  2 files to transfer, 527 bytes of data (no-zstd !)
84a93fa7ecfd revlog-compression: use zstd by default (if available)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46847
diff changeset
    79
  transferred 527 bytes in * seconds (*) (glob) (no-zstd !)
84a93fa7ecfd revlog-compression: use zstd by default (if available)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46847
diff changeset
    80
  2 files to transfer, 534 bytes of data (zstd !)
84a93fa7ecfd revlog-compression: use zstd by default (if available)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46847
diff changeset
    81
  transferred 534 bytes in * seconds (* */sec) (glob) (zstd !)
40495
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    82
  searching for changes
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    83
  no changes found
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    84
  updating to branch default
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    85
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    86
  1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    87
  $ cd shallow2
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    88
  $ printf "[extensions]\nsparse=\n" >> .hg/hgrc
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    89
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    90
  $ hg up -q 0
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    91
  2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over *s (glob)
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    92
  $ touch a
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    93
  $ hg ci -Aqm a
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    94
  $ hg push -q -f
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    95
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    96
## Pull the unrelated commit and rebase onto it - verify unrelated file was not
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    97
pulled
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    98
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
    99
  $ cd ../shallow
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
   100
  $ hg up -q 1
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
   101
  $ hg pull -q
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
   102
  $ hg debugsparse -I z
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
   103
  $ clearcache
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
   104
  $ hg prefetch -r '. + .^' -I x -I z
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
   105
  4 files fetched over 1 fetches - (4 misses, 0.00% hit ratio) over * (glob)
3a333a582d7b remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff changeset
   106
  $ hg rebase -d 2 --keep
45771
f90a5c211251 rebase: change and standarize template for rebase's one-line summary
Martin von Zweigbergk <martinvonz@google.com>
parents: 42897
diff changeset
   107
  rebasing 1:876b1317060d foo "x2"