tests/test-repo-compengines.t
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
Tue, 02 May 2017 20:01:54 +0200
branchstable
changeset 32102 9a85ea1daf49
parent 30818 4c0a5a256ae8
child 37415 c2c8962a9465
permissions -rw-r--r--
color: turn 'ui.color' into a boolean (auto or off) Previously, 'ui.color=yes' meant "always show color", While "ui.color=auto" meant "use color automatically when it appears sensible". This feels problematic to some people because if an administrator has disabled color with "ui.color=off", and a user turn it back on using "color=on", it will get surprised (because it breaks their output when redirected to a file.) This patch changes ui.color=true to only move the default value of --color from "never" to "auto". I'm not really in favor of this changes as I suspect the above case will be pretty rare and I would rather keep the logic simpler. However, I'm providing this patch to help the 4.2 release in the case were others decide to make this changes. Users that want to force colors without specifying --color on the command line can use the 'ui.formatted' config knob, which had to be enabled in a handful of tests for this patch. Nice summary table (credit: Augie Fackler) That is, before this patch: +--------------------+--------------------+--------------------+ | | not a tty | a tty | | | --color not set | --color not set | | | | | +--------------------+--------------------+--------------------+ | [ui] | | | | color (not set) | no color | no color | | | | | +--------------------+--------------------+--------------------+ | [ui] | | | | color = auto | no color | color | | | | | +--------------------+--------------------+--------------------+ | [ui] | | | | color = yes | *color* | color | | | | | +--------------------+--------------------+--------------------+ | [ui] | | | | color = no | no color | no color | | | | | +--------------------+--------------------+--------------------+ (if --color is specified, it always clobbers the setting in [ui]) and after this patch: +--------------------+--------------------+--------------------+ | | not a tty | a tty | | | --color not set | --color not set | | | | | +--------------------+--------------------+--------------------+ | [ui] | | | | color (not set) | no color | no color | | | | | +--------------------+--------------------+--------------------+ | [ui] | | | | color = auto | no color | color | | | | | +--------------------+--------------------+--------------------+ | [ui] | | | | color = yes | *no color* | color | | | | | +--------------------+--------------------+--------------------+ | [ui] | | | | color = no | no color | no color | | | | | +--------------------+--------------------+--------------------+ (if --color is specified, it always clobbers the setting in [ui])
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30818
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     1
A new repository uses zlib storage, which doesn't need a requirement
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     2
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     3
  $ hg init default
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     4
  $ cd default
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     5
  $ cat .hg/requires
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     6
  dotencode
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     7
  fncache
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     8
  generaldelta
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     9
  revlogv1
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    10
  store
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    11
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    12
  $ touch foo
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    13
  $ hg -q commit -A -m 'initial commit with a lot of repeated repeated repeated text to trigger compression'
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    14
  $ hg debugrevlog -c | grep 0x78
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    15
      0x78 (x)  :   1 (100.00%)
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    16
      0x78 (x)  : 110 (100.00%)
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    17
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    18
  $ cd ..
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    19
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    20
Unknown compression engine to format.compression aborts
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    21
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    22
  $ hg --config experimental.format.compression=unknown init unknown
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    23
  abort: compression engine unknown defined by experimental.format.compression not available
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    24
  (run "hg debuginstall" to list available compression engines)
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    25
  [255]
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    26
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    27
A requirement specifying an unknown compression engine results in bail
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    28
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    29
  $ hg init unknownrequirement
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    30
  $ cd unknownrequirement
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    31
  $ echo exp-compression-unknown >> .hg/requires
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    32
  $ hg log
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    33
  abort: repository requires features unknown to this Mercurial: exp-compression-unknown!
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    34
  (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    35
  [255]
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    36
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    37
  $ cd ..
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    38
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    39
#if zstd
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    40
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    41
  $ hg --config experimental.format.compression=zstd init zstd
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    42
  $ cd zstd
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    43
  $ cat .hg/requires
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    44
  dotencode
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    45
  exp-compression-zstd
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    46
  fncache
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    47
  generaldelta
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    48
  revlogv1
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    49
  store
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    50
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    51
  $ touch foo
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    52
  $ hg -q commit -A -m 'initial commit with a lot of repeated repeated repeated text'
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    53
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    54
  $ hg debugrevlog -c | grep 0x28
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    55
      0x28      :  1 (100.00%)
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    56
      0x28      : 98 (100.00%)
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    57
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    58
  $ cd ..
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    59
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    60
Specifying a new format.compression on an existing repo won't introduce data
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    61
with that engine or a requirement
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    62
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    63
  $ cd default
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    64
  $ touch bar
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    65
  $ hg --config experimental.format.compression=zstd -q commit -A -m 'add bar with a lot of repeated repeated repeated text'
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    66
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    67
  $ cat .hg/requires
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    68
  dotencode
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    69
  fncache
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    70
  generaldelta
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    71
  revlogv1
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    72
  store
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    73
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    74
  $ hg debugrevlog -c | grep 0x78
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    75
      0x78 (x)  :   2 (100.00%)
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    76
      0x78 (x)  : 199 (100.00%)
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    77
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    78
#endif