view tests/test-sparse-requirement.t @ 35930:83d67257ba90

tests: add low-level SSH protocol tests We don't really have good low-level tests for the behavior of the SSH wire protocol. This commit attempts to establish some. The added tests consist of a mixture of starting a server with `hg serve --stdio` and sending bytes to it and using `hg debugpeer` to go through the official client code. Having insight into what raw bytes are exchanged as well as what the peer does is useful. We also introduce a test extension for modifying the behavior of the SSH server and peer. For example, we change the server to not recognize the "hello" command, simulating behavior of <0.9.1 servers. These tests are generally useful to have. But the impetus for creating them now is they will be needed for verifying behavior of old clients and servers when a new SSH protocol is introduced. Differential Revision: https://phab.mercurial-scm.org/D2026 # no-check-commit because of serve_forever()
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 04 Feb 2018 14:02:41 -0800
parents 22371eabb3b1
children c2c8962a9465
line wrap: on
line source

  $ hg init repo
  $ cd repo

  $ touch a.html b.html c.py d.py

  $ cat > frontend.sparse << EOF
  > [include]
  > *.html
  > EOF

  $ hg -q commit -A -m initial

  $ echo 1 > a.html
  $ echo 1 > c.py
  $ hg commit -m 'commit 1'

Enable sparse profile

  $ cat .hg/requires
  dotencode
  fncache
  generaldelta
  revlogv1
  store

  $ hg debugsparse --config extensions.sparse= --enable-profile frontend.sparse
  $ ls
  a.html
  b.html

Requirement for sparse added when sparse is enabled

  $ cat .hg/requires
  dotencode
  exp-sparse
  fncache
  generaldelta
  revlogv1
  store

Client without sparse enabled reacts properly

  $ hg files
  abort: repository is using sparse feature but sparse is not enabled; enable the "sparse" extensions to access!
  [255]

Requirement for sparse is removed when sparse is disabled

  $ hg debugsparse --reset --config extensions.sparse=

  $ cat .hg/requires
  dotencode
  fncache
  generaldelta
  revlogv1
  store

And client without sparse can access

  $ hg files
  a.html
  b.html
  c.py
  d.py
  frontend.sparse