tests/test-config.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Thu, 15 Apr 2021 20:13:29 +0200
changeset 47272 a671832a8e41
parent 47071 3e381eb557f3
child 47279 40b51c28b242
permissions -rw-r--r--
urlutil: move url "fixing" at the time of `ui.paths` initialization Doing such fixing at the time is simpler and will be necessary to deal with urls list in a sane manner. It also reduce the size of fix-config which is always better. I wish we could get ride of the hackish way to pass the root around, I suspect that the `root` variable could be stored as part of the config value, along side the source. However getting to the end of this `root` business is a far too large detours to make now. The test change to `tests/test-hgrc.t` and `test-config.t` are expectied since we are not longer altering the config itself, but the way it is interpreted when building path. This seems more correct. I also added a couple of test call to `test-config.t` and `test-globalopts.t` to clarify that the expanding process is properly happening a the right time. Differential Revision: https://phab.mercurial-scm.org/D10451
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46867
915a60bf3cb6 tests: handle Windows file separator differences in test-config.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 46820
diff changeset
     1
Windows needs ';' as a file separator in an environment variable, and MSYS
915a60bf3cb6 tests: handle Windows file separator differences in test-config.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 46820
diff changeset
     2
doesn't automatically convert it in every case.
915a60bf3cb6 tests: handle Windows file separator differences in test-config.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 46820
diff changeset
     3
915a60bf3cb6 tests: handle Windows file separator differences in test-config.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 46820
diff changeset
     4
#if windows
915a60bf3cb6 tests: handle Windows file separator differences in test-config.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 46820
diff changeset
     5
  $ path_list_var() {
915a60bf3cb6 tests: handle Windows file separator differences in test-config.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 46820
diff changeset
     6
  >     echo $1 | sed 's/:/;/'
915a60bf3cb6 tests: handle Windows file separator differences in test-config.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 46820
diff changeset
     7
  > }
915a60bf3cb6 tests: handle Windows file separator differences in test-config.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 46820
diff changeset
     8
#else
915a60bf3cb6 tests: handle Windows file separator differences in test-config.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 46820
diff changeset
     9
  $ path_list_var() {
915a60bf3cb6 tests: handle Windows file separator differences in test-config.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 46820
diff changeset
    10
  >     echo $1
915a60bf3cb6 tests: handle Windows file separator differences in test-config.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 46820
diff changeset
    11
  > }
915a60bf3cb6 tests: handle Windows file separator differences in test-config.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 46820
diff changeset
    12
#endif
915a60bf3cb6 tests: handle Windows file separator differences in test-config.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 46820
diff changeset
    13
915a60bf3cb6 tests: handle Windows file separator differences in test-config.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 46820
diff changeset
    14
17015
73d20de5f30b tests: add missing no-outer-repo requirements
Mads Kiilerich <mads@kiilerich.com>
parents: 12082
diff changeset
    15
hide outer repo
73d20de5f30b tests: add missing no-outer-repo requirements
Mads Kiilerich <mads@kiilerich.com>
parents: 12082
diff changeset
    16
  $ hg init
73d20de5f30b tests: add missing no-outer-repo requirements
Mads Kiilerich <mads@kiilerich.com>
parents: 12082
diff changeset
    17
22275
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    18
Invalid syntax: no value
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    19
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    20
  $ cat > .hg/hgrc << EOF
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    21
  > novaluekey
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    22
  > EOF
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    23
  $ hg showconfig
45894
9dc1351d0b5f errors: raise ConfigError on failure to parse config file
Martin von Zweigbergk <martinvonz@google.com>
parents: 45827
diff changeset
    24
  config error at $TESTTMP/.hg/hgrc:1: novaluekey
9dc1351d0b5f errors: raise ConfigError on failure to parse config file
Martin von Zweigbergk <martinvonz@google.com>
parents: 45827
diff changeset
    25
  [30]
22275
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    26
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    27
Invalid syntax: no key
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    28
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    29
  $ cat > .hg/hgrc << EOF
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    30
  > =nokeyvalue
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    31
  > EOF
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    32
  $ hg showconfig
45894
9dc1351d0b5f errors: raise ConfigError on failure to parse config file
Martin von Zweigbergk <martinvonz@google.com>
parents: 45827
diff changeset
    33
  config error at $TESTTMP/.hg/hgrc:1: =nokeyvalue
9dc1351d0b5f errors: raise ConfigError on failure to parse config file
Martin von Zweigbergk <martinvonz@google.com>
parents: 45827
diff changeset
    34
  [30]
22275
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    35
22276
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    36
Test hint about invalid syntax from leading white space
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    37
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    38
  $ cat > .hg/hgrc << EOF
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    39
  >  key=value
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    40
  > EOF
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    41
  $ hg showconfig
45894
9dc1351d0b5f errors: raise ConfigError on failure to parse config file
Martin von Zweigbergk <martinvonz@google.com>
parents: 45827
diff changeset
    42
  config error at $TESTTMP/.hg/hgrc:1: unexpected leading whitespace:  key=value
9dc1351d0b5f errors: raise ConfigError on failure to parse config file
Martin von Zweigbergk <martinvonz@google.com>
parents: 45827
diff changeset
    43
  [30]
22276
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    44
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    45
  $ cat > .hg/hgrc << EOF
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    46
  >  [section]
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    47
  > key=value
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    48
  > EOF
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    49
  $ hg showconfig
45894
9dc1351d0b5f errors: raise ConfigError on failure to parse config file
Martin von Zweigbergk <martinvonz@google.com>
parents: 45827
diff changeset
    50
  config error at $TESTTMP/.hg/hgrc:1: unexpected leading whitespace:  [section]
9dc1351d0b5f errors: raise ConfigError on failure to parse config file
Martin von Zweigbergk <martinvonz@google.com>
parents: 45827
diff changeset
    51
  [30]
22276
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    52
22275
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    53
Reset hgrc
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    54
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    55
  $ echo > .hg/hgrc
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    56
19086
8fb8dce3f9b6 tests: rename from test-config-case.t to test-config.t for centralization
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17015
diff changeset
    57
Test case sensitive configuration
8fb8dce3f9b6 tests: rename from test-config-case.t to test-config.t for centralization
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17015
diff changeset
    58
23172
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 22367
diff changeset
    59
  $ cat <<EOF >> $HGRCPATH
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 22367
diff changeset
    60
  > [Section]
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 22367
diff changeset
    61
  > KeY = Case Sensitive
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 22367
diff changeset
    62
  > key = lower case
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 22367
diff changeset
    63
  > EOF
3425
ec6f400cff4d Use a case-sensitive version of SafeConfigParser everywhere
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    64
12082
5e2216a35839 tests: unify test-config-case
Adrian Buehlmann <adrian@cadifra.com>
parents: 4528
diff changeset
    65
  $ hg showconfig Section
5e2216a35839 tests: unify test-config-case
Adrian Buehlmann <adrian@cadifra.com>
parents: 4528
diff changeset
    66
  Section.KeY=Case Sensitive
5e2216a35839 tests: unify test-config-case
Adrian Buehlmann <adrian@cadifra.com>
parents: 4528
diff changeset
    67
  Section.key=lower case
3425
ec6f400cff4d Use a case-sensitive version of SafeConfigParser everywhere
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    68
29950
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    69
  $ hg showconfig Section -Tjson
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    70
  [
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    71
   {
42706
60789444acd6 config: fix fm.data() handling of defaultvalue
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 42705
diff changeset
    72
    "defaultvalue": null,
29950
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    73
    "name": "Section.KeY",
30986
f07ca071a058 runtests: set web.ipv6 if we use IPv6
Jun Wu <quark@fb.com>
parents: 30618
diff changeset
    74
    "source": "*.hgrc:*", (glob)
29950
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    75
    "value": "Case Sensitive"
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    76
   },
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    77
   {
42706
60789444acd6 config: fix fm.data() handling of defaultvalue
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 42705
diff changeset
    78
    "defaultvalue": null,
29950
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    79
    "name": "Section.key",
30986
f07ca071a058 runtests: set web.ipv6 if we use IPv6
Jun Wu <quark@fb.com>
parents: 30618
diff changeset
    80
    "source": "*.hgrc:*", (glob)
29950
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    81
    "value": "lower case"
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    82
   }
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    83
  ]
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    84
  $ hg showconfig Section.KeY -Tjson
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    85
  [
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    86
   {
42705
049b2ac3252e config: remove pycompat.bytestr() for defaultvalue
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 42672
diff changeset
    87
    "defaultvalue": null,
29950
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    88
    "name": "Section.KeY",
30986
f07ca071a058 runtests: set web.ipv6 if we use IPv6
Jun Wu <quark@fb.com>
parents: 30618
diff changeset
    89
    "source": "*.hgrc:*", (glob)
29950
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    90
    "value": "Case Sensitive"
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    91
   }
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    92
  ]
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    93
  $ hg showconfig -Tjson | tail -7
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    94
   {
42706
60789444acd6 config: fix fm.data() handling of defaultvalue
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 42705
diff changeset
    95
    "defaultvalue": null,
29950
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    96
    "name": "*", (glob)
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    97
    "source": "*", (glob)
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    98
    "value": "*" (glob)
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    99
   }
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
   100
  ]
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
   101
43335
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   102
Test config default of various types:
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   103
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   104
 {"defaultvalue": ""} for -T'json(defaultvalue)' looks weird, but that's
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   105
 how the templater works. Unknown keywords are evaluated to "".
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   106
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   107
 dynamicdefault
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   108
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   109
  $ hg config --config alias.foo= alias -Tjson
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   110
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   111
   {
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   112
    "name": "alias.foo",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   113
    "source": "--config",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   114
    "value": ""
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   115
   }
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   116
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   117
  $ hg config --config alias.foo= alias -T'json(defaultvalue)'
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   118
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   119
   {"defaultvalue": ""}
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   120
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   121
  $ hg config --config alias.foo= alias -T'{defaultvalue}\n'
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   122
  
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   123
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   124
 null
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   125
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   126
  $ hg config --config auth.cookiefile= auth -Tjson
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   127
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   128
   {
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   129
    "defaultvalue": null,
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   130
    "name": "auth.cookiefile",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   131
    "source": "--config",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   132
    "value": ""
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   133
   }
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   134
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   135
  $ hg config --config auth.cookiefile= auth -T'json(defaultvalue)'
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   136
  [
43337
7e20b705da5b formatter: fix handling of None value in templater mapping
Yuya Nishihara <yuya@tcha.org>
parents: 43336
diff changeset
   137
   {"defaultvalue": null}
43335
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   138
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   139
  $ hg config --config auth.cookiefile= auth -T'{defaultvalue}\n'
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   140
  
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   141
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   142
 false
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   143
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   144
  $ hg config --config commands.commit.post-status= commands -Tjson
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   145
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   146
   {
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   147
    "defaultvalue": false,
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   148
    "name": "commands.commit.post-status",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   149
    "source": "--config",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   150
    "value": ""
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   151
   }
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   152
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   153
  $ hg config --config commands.commit.post-status= commands -T'json(defaultvalue)'
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   154
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   155
   {"defaultvalue": false}
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   156
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   157
  $ hg config --config commands.commit.post-status= commands -T'{defaultvalue}\n'
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   158
  False
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   159
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   160
 true
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   161
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   162
  $ hg config --config format.dotencode= format -Tjson
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   163
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   164
   {
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   165
    "defaultvalue": true,
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   166
    "name": "format.dotencode",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   167
    "source": "--config",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   168
    "value": ""
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   169
   }
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   170
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   171
  $ hg config --config format.dotencode= format -T'json(defaultvalue)'
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   172
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   173
   {"defaultvalue": true}
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   174
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   175
  $ hg config --config format.dotencode= format -T'{defaultvalue}\n'
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   176
  True
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   177
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   178
 bytes
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   179
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   180
  $ hg config --config commands.resolve.mark-check= commands -Tjson
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   181
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   182
   {
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   183
    "defaultvalue": "none",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   184
    "name": "commands.resolve.mark-check",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   185
    "source": "--config",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   186
    "value": ""
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   187
   }
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   188
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   189
  $ hg config --config commands.resolve.mark-check= commands -T'json(defaultvalue)'
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   190
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   191
   {"defaultvalue": "none"}
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   192
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   193
  $ hg config --config commands.resolve.mark-check= commands -T'{defaultvalue}\n'
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   194
  none
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   195
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   196
 empty list
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   197
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   198
  $ hg config --config commands.show.aliasprefix= commands -Tjson
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   199
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   200
   {
43336
a71578ec6257 config: add support for defaultvalue of list of printable elements
Yuya Nishihara <yuya@tcha.org>
parents: 43335
diff changeset
   201
    "defaultvalue": [],
43335
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   202
    "name": "commands.show.aliasprefix",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   203
    "source": "--config",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   204
    "value": ""
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   205
   }
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   206
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   207
  $ hg config --config commands.show.aliasprefix= commands -T'json(defaultvalue)'
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   208
  [
43336
a71578ec6257 config: add support for defaultvalue of list of printable elements
Yuya Nishihara <yuya@tcha.org>
parents: 43335
diff changeset
   209
   {"defaultvalue": []}
43335
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   210
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   211
  $ hg config --config commands.show.aliasprefix= commands -T'{defaultvalue}\n'
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   212
  
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   213
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   214
 nonempty list
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   215
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   216
  $ hg config --config progress.format= progress -Tjson
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   217
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   218
   {
43336
a71578ec6257 config: add support for defaultvalue of list of printable elements
Yuya Nishihara <yuya@tcha.org>
parents: 43335
diff changeset
   219
    "defaultvalue": ["topic", "bar", "number", "estimate"],
43335
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   220
    "name": "progress.format",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   221
    "source": "--config",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   222
    "value": ""
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   223
   }
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   224
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   225
  $ hg config --config progress.format= progress -T'json(defaultvalue)'
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   226
  [
43336
a71578ec6257 config: add support for defaultvalue of list of printable elements
Yuya Nishihara <yuya@tcha.org>
parents: 43335
diff changeset
   227
   {"defaultvalue": ["topic", "bar", "number", "estimate"]}
43335
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   228
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   229
  $ hg config --config progress.format= progress -T'{defaultvalue}\n'
43336
a71578ec6257 config: add support for defaultvalue of list of printable elements
Yuya Nishihara <yuya@tcha.org>
parents: 43335
diff changeset
   230
  topic bar number estimate
43335
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   231
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   232
 int
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   233
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   234
  $ hg config --config profiling.freq= profiling -Tjson
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   235
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   236
   {
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   237
    "defaultvalue": 1000,
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   238
    "name": "profiling.freq",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   239
    "source": "--config",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   240
    "value": ""
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   241
   }
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   242
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   243
  $ hg config --config profiling.freq= profiling -T'json(defaultvalue)'
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   244
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   245
   {"defaultvalue": 1000}
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   246
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   247
  $ hg config --config profiling.freq= profiling -T'{defaultvalue}\n'
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   248
  1000
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   249
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   250
 float
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   251
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   252
  $ hg config --config profiling.showmax= profiling -Tjson
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   253
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   254
   {
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   255
    "defaultvalue": 0.999,
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   256
    "name": "profiling.showmax",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   257
    "source": "--config",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   258
    "value": ""
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   259
   }
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   260
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   261
  $ hg config --config profiling.showmax= profiling -T'json(defaultvalue)'
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   262
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   263
   {"defaultvalue": 0.999}
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   264
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   265
  $ hg config --config profiling.showmax= profiling -T'{defaultvalue}\n'
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   266
  0.999
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42706
diff changeset
   267
30618
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29950
diff changeset
   268
Test empty config source:
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29950
diff changeset
   269
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29950
diff changeset
   270
  $ cat <<EOF > emptysource.py
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29950
diff changeset
   271
  > def reposetup(ui, repo):
36730
a22915edc279 py3: byte-stringify test-config.t and test-config-env.py
Yuya Nishihara <yuya@tcha.org>
parents: 35393
diff changeset
   272
  >     ui.setconfig(b'empty', b'source', b'value')
30618
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29950
diff changeset
   273
  > EOF
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29950
diff changeset
   274
  $ cp .hg/hgrc .hg/hgrc.orig
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29950
diff changeset
   275
  $ cat <<EOF >> .hg/hgrc
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29950
diff changeset
   276
  > [extensions]
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29950
diff changeset
   277
  > emptysource = `pwd`/emptysource.py
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29950
diff changeset
   278
  > EOF
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29950
diff changeset
   279
47071
3e381eb557f3 config: add --source option to include source of value
Martin von Zweigbergk <martinvonz@google.com>
parents: 46867
diff changeset
   280
  $ hg config --source empty.source
30618
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29950
diff changeset
   281
  none: value
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29950
diff changeset
   282
  $ hg config empty.source -Tjson
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29950
diff changeset
   283
  [
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29950
diff changeset
   284
   {
42705
049b2ac3252e config: remove pycompat.bytestr() for defaultvalue
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 42672
diff changeset
   285
    "defaultvalue": null,
30618
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29950
diff changeset
   286
    "name": "empty.source",
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29950
diff changeset
   287
    "source": "",
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29950
diff changeset
   288
    "value": "value"
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29950
diff changeset
   289
   }
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29950
diff changeset
   290
  ]
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29950
diff changeset
   291
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29950
diff changeset
   292
  $ cp .hg/hgrc.orig .hg/hgrc
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29950
diff changeset
   293
19087
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   294
Test "%unset"
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   295
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   296
  $ cat >> $HGRCPATH <<EOF
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   297
  > [unsettest]
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   298
  > local-hgrcpath = should be unset (HGRCPATH)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   299
  > %unset local-hgrcpath
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   300
  > 
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   301
  > global = should be unset (HGRCPATH)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   302
  > 
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   303
  > both = should be unset (HGRCPATH)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   304
  > 
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   305
  > set-after-unset = should be unset (HGRCPATH)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   306
  > EOF
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   307
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   308
  $ cat >> .hg/hgrc <<EOF
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   309
  > [unsettest]
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   310
  > local-hgrc = should be unset (.hg/hgrc)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   311
  > %unset local-hgrc
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   312
  > 
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   313
  > %unset global
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   314
  > 
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   315
  > both = should be unset (.hg/hgrc)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   316
  > %unset both
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   317
  > 
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   318
  > set-after-unset = should be unset (.hg/hgrc)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   319
  > %unset set-after-unset
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   320
  > set-after-unset = should be set (.hg/hgrc)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   321
  > EOF
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   322
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   323
  $ hg showconfig unsettest
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   324
  unsettest.set-after-unset=should be set (.hg/hgrc)
22316
816be4ca4ae2 config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents: 19087
diff changeset
   325
816be4ca4ae2 config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents: 19087
diff changeset
   326
Test exit code when no config matches
816be4ca4ae2 config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents: 19087
diff changeset
   327
816be4ca4ae2 config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents: 19087
diff changeset
   328
  $ hg config Section.idontexist
816be4ca4ae2 config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents: 19087
diff changeset
   329
  [1]
29412
b62bce819d0c ui: don't fixup [paths] sub-options
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23348
diff changeset
   330
b62bce819d0c ui: don't fixup [paths] sub-options
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23348
diff changeset
   331
sub-options in [paths] aren't expanded
b62bce819d0c ui: don't fixup [paths] sub-options
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23348
diff changeset
   332
b62bce819d0c ui: don't fixup [paths] sub-options
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23348
diff changeset
   333
  $ cat > .hg/hgrc << EOF
b62bce819d0c ui: don't fixup [paths] sub-options
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23348
diff changeset
   334
  > [paths]
b62bce819d0c ui: don't fixup [paths] sub-options
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23348
diff changeset
   335
  > foo = ~/foo
b62bce819d0c ui: don't fixup [paths] sub-options
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23348
diff changeset
   336
  > foo:suboption = ~/foo
b62bce819d0c ui: don't fixup [paths] sub-options
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23348
diff changeset
   337
  > EOF
b62bce819d0c ui: don't fixup [paths] sub-options
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23348
diff changeset
   338
b62bce819d0c ui: don't fixup [paths] sub-options
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23348
diff changeset
   339
  $ hg showconfig paths
47272
a671832a8e41 urlutil: move url "fixing" at the time of `ui.paths` initialization
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47071
diff changeset
   340
  paths.foo=~/foo
29412
b62bce819d0c ui: don't fixup [paths] sub-options
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23348
diff changeset
   341
  paths.foo:suboption=~/foo
47272
a671832a8e41 urlutil: move url "fixing" at the time of `ui.paths` initialization
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47071
diff changeset
   342
a671832a8e41 urlutil: move url "fixing" at the time of `ui.paths` initialization
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47071
diff changeset
   343
note: The path expansion no longer happens at the config level, but the path is
a671832a8e41 urlutil: move url "fixing" at the time of `ui.paths` initialization
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47071
diff changeset
   344
still expanded:
a671832a8e41 urlutil: move url "fixing" at the time of `ui.paths` initialization
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47071
diff changeset
   345
a671832a8e41 urlutil: move url "fixing" at the time of `ui.paths` initialization
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47071
diff changeset
   346
  $ hg path | grep foo
a671832a8e41 urlutil: move url "fixing" at the time of `ui.paths` initialization
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47071
diff changeset
   347
  foo = $TESTTMP/foo
31108
3f8f53190d6a chg: deduplicate error handling of ui.system()
Yuya Nishihara <yuya@tcha.org>
parents: 30986
diff changeset
   348
3f8f53190d6a chg: deduplicate error handling of ui.system()
Yuya Nishihara <yuya@tcha.org>
parents: 30986
diff changeset
   349
edit failure
3f8f53190d6a chg: deduplicate error handling of ui.system()
Yuya Nishihara <yuya@tcha.org>
parents: 30986
diff changeset
   350
3f8f53190d6a chg: deduplicate error handling of ui.system()
Yuya Nishihara <yuya@tcha.org>
parents: 30986
diff changeset
   351
  $ HGEDITOR=false hg config --edit
3f8f53190d6a chg: deduplicate error handling of ui.system()
Yuya Nishihara <yuya@tcha.org>
parents: 30986
diff changeset
   352
  abort: edit failed: false exited with status 1
45827
8d72e29ad1e0 errors: introduce InputError and use it from commands and cmdutil
Martin von Zweigbergk <martinvonz@google.com>
parents: 45777
diff changeset
   353
  [10]
31685
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31108
diff changeset
   354
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31108
diff changeset
   355
config affected by environment variables
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31108
diff changeset
   356
47071
3e381eb557f3 config: add --source option to include source of value
Martin von Zweigbergk <martinvonz@google.com>
parents: 46867
diff changeset
   357
  $ EDITOR=e1 VISUAL=e2 hg config --source | grep 'ui\.editor'
31685
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31108
diff changeset
   358
  $VISUAL: ui.editor=e2
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31108
diff changeset
   359
47071
3e381eb557f3 config: add --source option to include source of value
Martin von Zweigbergk <martinvonz@google.com>
parents: 46867
diff changeset
   360
  $ VISUAL=e2 hg config --source --config ui.editor=e3 | grep 'ui\.editor'
31685
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31108
diff changeset
   361
  --config: ui.editor=e3
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31108
diff changeset
   362
47071
3e381eb557f3 config: add --source option to include source of value
Martin von Zweigbergk <martinvonz@google.com>
parents: 46867
diff changeset
   363
  $ PAGER=p1 hg config --source | grep 'pager\.pager'
31685
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31108
diff changeset
   364
  $PAGER: pager.pager=p1
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31108
diff changeset
   365
47071
3e381eb557f3 config: add --source option to include source of value
Martin von Zweigbergk <martinvonz@google.com>
parents: 46867
diff changeset
   366
  $ PAGER=p1 hg config --source --config pager.pager=p2 | grep 'pager\.pager'
31685
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31108
diff changeset
   367
  --config: pager.pager=p2
33329
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   368
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   369
verify that aliases are evaluated as well
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   370
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   371
  $ hg init aliastest
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   372
  $ cd aliastest
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   373
  $ cat > .hg/hgrc << EOF
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   374
  > [ui]
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   375
  > user = repo user
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   376
  > EOF
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   377
  $ touch index
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   378
  $ unset HGUSER
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   379
  $ hg ci -Am test
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   380
  adding index
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   381
  $ hg log --template '{author}\n'
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   382
  repo user
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   383
  $ cd ..
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   384
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   385
alias has lower priority
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   386
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   387
  $ hg init aliaspriority
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   388
  $ cd aliaspriority
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   389
  $ cat > .hg/hgrc << EOF
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   390
  > [ui]
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   391
  > user = alias user
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   392
  > username = repo user
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   393
  > EOF
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   394
  $ touch index
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   395
  $ unset HGUSER
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   396
  $ hg ci -Am test
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   397
  adding index
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   398
  $ hg log --template '{author}\n'
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   399
  repo user
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31685
diff changeset
   400
  $ cd ..
42093
edbcf5b239f9 config: read configs from directories in lexicographical order
Martin von Zweigbergk <martinvonz@google.com>
parents: 36730
diff changeset
   401
edbcf5b239f9 config: read configs from directories in lexicographical order
Martin von Zweigbergk <martinvonz@google.com>
parents: 36730
diff changeset
   402
configs should be read in lexicographical order
edbcf5b239f9 config: read configs from directories in lexicographical order
Martin von Zweigbergk <martinvonz@google.com>
parents: 36730
diff changeset
   403
edbcf5b239f9 config: read configs from directories in lexicographical order
Martin von Zweigbergk <martinvonz@google.com>
parents: 36730
diff changeset
   404
  $ mkdir configs
edbcf5b239f9 config: read configs from directories in lexicographical order
Martin von Zweigbergk <martinvonz@google.com>
parents: 36730
diff changeset
   405
  $ for i in `$TESTDIR/seq.py 10 99`; do
edbcf5b239f9 config: read configs from directories in lexicographical order
Martin von Zweigbergk <martinvonz@google.com>
parents: 36730
diff changeset
   406
  >    printf "[section]\nkey=$i" > configs/$i.rc
edbcf5b239f9 config: read configs from directories in lexicographical order
Martin von Zweigbergk <martinvonz@google.com>
parents: 36730
diff changeset
   407
  > done
edbcf5b239f9 config: read configs from directories in lexicographical order
Martin von Zweigbergk <martinvonz@google.com>
parents: 36730
diff changeset
   408
  $ HGRCPATH=configs hg config section.key
edbcf5b239f9 config: read configs from directories in lexicographical order
Martin von Zweigbergk <martinvonz@google.com>
parents: 36730
diff changeset
   409
  99
46420
4ae85340d5eb config: add a test for priority when includes are involved
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46145
diff changeset
   410
4ae85340d5eb config: add a test for priority when includes are involved
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46145
diff changeset
   411
Configuration priority
4ae85340d5eb config: add a test for priority when includes are involved
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46145
diff changeset
   412
======================
4ae85340d5eb config: add a test for priority when includes are involved
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46145
diff changeset
   413
4ae85340d5eb config: add a test for priority when includes are involved
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46145
diff changeset
   414
setup necessary file
4ae85340d5eb config: add a test for priority when includes are involved
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46145
diff changeset
   415
4ae85340d5eb config: add a test for priority when includes are involved
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46145
diff changeset
   416
  $ cat > file-A.rc << EOF
4ae85340d5eb config: add a test for priority when includes are involved
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46145
diff changeset
   417
  > [config-test]
4ae85340d5eb config: add a test for priority when includes are involved
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46145
diff changeset
   418
  > basic = value-A
46421
9d49ae51aa56 config: test priority involving include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46420
diff changeset
   419
  > pre-include= value-A
9d49ae51aa56 config: test priority involving include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46420
diff changeset
   420
  > %include ./included.rc
9d49ae51aa56 config: test priority involving include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46420
diff changeset
   421
  > post-include= value-A
46615
377689cc295f config: test priority involving alias
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46422
diff changeset
   422
  > [command-templates]
377689cc295f config: test priority involving alias
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46422
diff changeset
   423
  > log = "value-A\n"
46420
4ae85340d5eb config: add a test for priority when includes are involved
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46145
diff changeset
   424
  > EOF
4ae85340d5eb config: add a test for priority when includes are involved
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46145
diff changeset
   425
4ae85340d5eb config: add a test for priority when includes are involved
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46145
diff changeset
   426
  $ cat > file-B.rc << EOF
4ae85340d5eb config: add a test for priority when includes are involved
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46145
diff changeset
   427
  > [config-test]
4ae85340d5eb config: add a test for priority when includes are involved
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46145
diff changeset
   428
  > basic = value-B
46615
377689cc295f config: test priority involving alias
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46422
diff changeset
   429
  > [ui]
377689cc295f config: test priority involving alias
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46422
diff changeset
   430
  > logtemplate = "value-B\n"
46420
4ae85340d5eb config: add a test for priority when includes are involved
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46145
diff changeset
   431
  > EOF
4ae85340d5eb config: add a test for priority when includes are involved
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46145
diff changeset
   432
46421
9d49ae51aa56 config: test priority involving include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46420
diff changeset
   433
9d49ae51aa56 config: test priority involving include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46420
diff changeset
   434
  $ cat > included.rc << EOF
9d49ae51aa56 config: test priority involving include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46420
diff changeset
   435
  > [config-test]
9d49ae51aa56 config: test priority involving include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46420
diff changeset
   436
  > pre-include= value-included
9d49ae51aa56 config: test priority involving include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46420
diff changeset
   437
  > post-include= value-included
9d49ae51aa56 config: test priority involving include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46420
diff changeset
   438
  > EOF
9d49ae51aa56 config: test priority involving include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46420
diff changeset
   439
46616
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   440
  $ cat > file-C.rc << EOF
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   441
  > %include ./included-alias-C.rc
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   442
  > [ui]
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   443
  > logtemplate = "value-C\n"
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   444
  > EOF
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   445
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   446
  $ cat > included-alias-C.rc << EOF
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   447
  > [command-templates]
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   448
  > log = "value-included\n"
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   449
  > EOF
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   450
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   451
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   452
  $ cat > file-D.rc << EOF
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   453
  > [command-templates]
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   454
  > log = "value-D\n"
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   455
  > %include ./included-alias-D.rc
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   456
  > EOF
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   457
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   458
  $ cat > included-alias-D.rc << EOF
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   459
  > [ui]
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   460
  > logtemplate = "value-included\n"
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   461
  > EOF
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   462
46420
4ae85340d5eb config: add a test for priority when includes are involved
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46145
diff changeset
   463
Simple order checking
4ae85340d5eb config: add a test for priority when includes are involved
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46145
diff changeset
   464
---------------------
4ae85340d5eb config: add a test for priority when includes are involved
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46145
diff changeset
   465
4ae85340d5eb config: add a test for priority when includes are involved
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46145
diff changeset
   466
If file B is read after file A, value from B overwrite value from A.
4ae85340d5eb config: add a test for priority when includes are involved
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46145
diff changeset
   467
46867
915a60bf3cb6 tests: handle Windows file separator differences in test-config.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 46820
diff changeset
   468
  $ HGRCPATH=`path_list_var "file-A.rc:file-B.rc"` hg config config-test.basic
46420
4ae85340d5eb config: add a test for priority when includes are involved
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46145
diff changeset
   469
  value-B
46421
9d49ae51aa56 config: test priority involving include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46420
diff changeset
   470
9d49ae51aa56 config: test priority involving include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46420
diff changeset
   471
Ordering from include
9d49ae51aa56 config: test priority involving include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46420
diff changeset
   472
---------------------
9d49ae51aa56 config: test priority involving include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46420
diff changeset
   473
9d49ae51aa56 config: test priority involving include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46420
diff changeset
   474
value from an include overwrite value defined before the include, but not the one defined after the include
9d49ae51aa56 config: test priority involving include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46420
diff changeset
   475
9d49ae51aa56 config: test priority involving include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46420
diff changeset
   476
  $ HGRCPATH="file-A.rc" hg config config-test.pre-include
9d49ae51aa56 config: test priority involving include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46420
diff changeset
   477
  value-included
9d49ae51aa56 config: test priority involving include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46420
diff changeset
   478
  $ HGRCPATH="file-A.rc" hg config config-test.post-include
9d49ae51aa56 config: test priority involving include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46420
diff changeset
   479
  value-A
46422
821775843caf config: test priority involving the command line
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46421
diff changeset
   480
821775843caf config: test priority involving the command line
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46421
diff changeset
   481
command line override
821775843caf config: test priority involving the command line
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46421
diff changeset
   482
---------------------
821775843caf config: test priority involving the command line
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46421
diff changeset
   483
46867
915a60bf3cb6 tests: handle Windows file separator differences in test-config.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 46820
diff changeset
   484
  $ HGRCPATH=`path_list_var "file-A.rc:file-B.rc"` hg config config-test.basic --config config-test.basic=value-CLI
46422
821775843caf config: test priority involving the command line
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46421
diff changeset
   485
  value-CLI
46615
377689cc295f config: test priority involving alias
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46422
diff changeset
   486
377689cc295f config: test priority involving alias
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46422
diff changeset
   487
Alias ordering
377689cc295f config: test priority involving alias
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46422
diff changeset
   488
--------------
377689cc295f config: test priority involving alias
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46422
diff changeset
   489
377689cc295f config: test priority involving alias
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46422
diff changeset
   490
The official config is now `command-templates.log`, the historical
377689cc295f config: test priority involving alias
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46422
diff changeset
   491
`ui.logtemplate` is a valid alternative for it.
377689cc295f config: test priority involving alias
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46422
diff changeset
   492
377689cc295f config: test priority involving alias
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46422
diff changeset
   493
When both are defined, The config value read the last "win", this should keep
377689cc295f config: test priority involving alias
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46422
diff changeset
   494
being true if the config have other alias. In other word, the config value read
377689cc295f config: test priority involving alias
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46422
diff changeset
   495
earlier will be considered "lower level" and the config read later would be
377689cc295f config: test priority involving alias
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46422
diff changeset
   496
considered "higher level". And higher level values wins.
377689cc295f config: test priority involving alias
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46422
diff changeset
   497
377689cc295f config: test priority involving alias
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46422
diff changeset
   498
  $ HGRCPATH="file-A.rc" hg log -r .
377689cc295f config: test priority involving alias
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46422
diff changeset
   499
  value-A
377689cc295f config: test priority involving alias
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46422
diff changeset
   500
  $ HGRCPATH="file-B.rc" hg log -r .
377689cc295f config: test priority involving alias
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46422
diff changeset
   501
  value-B
46867
915a60bf3cb6 tests: handle Windows file separator differences in test-config.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 46820
diff changeset
   502
  $ HGRCPATH=`path_list_var "file-A.rc:file-B.rc"` hg log -r .
46623
b91a695b3b08 config: use level to properly deal with value priority
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46617
diff changeset
   503
  value-B
46616
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   504
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   505
Alias and include
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   506
-----------------
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   507
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   508
The pre/post include priority should also apply when tie-breaking alternatives.
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   509
See the case above for details about the two config options used.
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   510
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   511
  $ HGRCPATH="file-C.rc" hg log -r .
46623
b91a695b3b08 config: use level to properly deal with value priority
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46617
diff changeset
   512
  value-C
46616
702bb73d7330 config: test priority involving alias and include
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46615
diff changeset
   513
  $ HGRCPATH="file-D.rc" hg log -r .
46623
b91a695b3b08 config: use level to properly deal with value priority
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46617
diff changeset
   514
  value-included
46617
87f8b3add56b config: test priority involving alias and cli
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46616
diff changeset
   515
87f8b3add56b config: test priority involving alias and cli
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46616
diff changeset
   516
command line override
87f8b3add56b config: test priority involving alias and cli
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46616
diff changeset
   517
---------------------
87f8b3add56b config: test priority involving alias and cli
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46616
diff changeset
   518
46867
915a60bf3cb6 tests: handle Windows file separator differences in test-config.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 46820
diff changeset
   519
  $ HGRCPATH=`path_list_var "file-A.rc:file-B.rc"` hg log -r . --config ui.logtemplate="value-CLI\n"
46623
b91a695b3b08 config: use level to properly deal with value priority
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46617
diff changeset
   520
  value-CLI