tests/test-config.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Sat, 05 Dec 2020 23:27:57 +0100
changeset 46047 024f90fc01b5
parent 46004 60523483897c
child 46146 6383bb86b700
permissions -rw-r--r--
phab-refresh: do not pick draft changeset from the bare "default" branch My initial test overlooked a common case: draft changeset on the default branch. So right now, heptapod is doing a final refresh of the patch with the landed version. This is not a bit problem except for the extra noise. However we would be better without the noise. Differential Revision: https://phab.mercurial-scm.org/D9522
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17015
73d20de5f30b tests: add missing no-outer-repo requirements
Mads Kiilerich <mads@kiilerich.com>
parents: 12082
diff changeset
     1
hide outer repo
73d20de5f30b tests: add missing no-outer-repo requirements
Mads Kiilerich <mads@kiilerich.com>
parents: 12082
diff changeset
     2
  $ hg init
73d20de5f30b tests: add missing no-outer-repo requirements
Mads Kiilerich <mads@kiilerich.com>
parents: 12082
diff changeset
     3
22275
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
     4
Invalid syntax: no value
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
     5
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
     6
  $ cat > .hg/hgrc << EOF
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
     7
  > novaluekey
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
     8
  > EOF
46004
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
     9
#if chg
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
    10
  $ hg showconfig
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
    11
  config error at $TESTTMP/.hg/hgrc:1: novaluekey
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
    12
  [255]
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
    13
#else
22275
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    14
  $ hg showconfig
45909
9dc1351d0b5f errors: raise ConfigError on failure to parse config file
Martin von Zweigbergk <martinvonz@google.com>
parents: 45846
diff changeset
    15
  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: 45846
diff changeset
    16
  [30]
46004
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
    17
#endif
22275
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    18
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    19
Invalid syntax: no key
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    20
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    21
  $ cat > .hg/hgrc << EOF
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    22
  > =nokeyvalue
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    23
  > EOF
46004
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
    24
#if chg
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
    25
  $ hg showconfig
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
    26
  config error at $TESTTMP/.hg/hgrc:1: =nokeyvalue
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
    27
  [255]
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
    28
#else
22275
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    29
  $ hg showconfig
45909
9dc1351d0b5f errors: raise ConfigError on failure to parse config file
Martin von Zweigbergk <martinvonz@google.com>
parents: 45846
diff changeset
    30
  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: 45846
diff changeset
    31
  [30]
46004
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
    32
#endif
22275
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    33
22276
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    34
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
    35
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    36
  $ cat > .hg/hgrc << EOF
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    37
  >  key=value
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    38
  > EOF
46004
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
    39
#if chg
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
    40
  $ hg showconfig
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
    41
  config error at $TESTTMP/.hg/hgrc:1: unexpected leading whitespace:  key=value
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
    42
  [255]
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
    43
#else
22276
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    44
  $ hg showconfig
45909
9dc1351d0b5f errors: raise ConfigError on failure to parse config file
Martin von Zweigbergk <martinvonz@google.com>
parents: 45846
diff changeset
    45
  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: 45846
diff changeset
    46
  [30]
46004
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
    47
#endif
22276
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    48
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    49
  $ cat > .hg/hgrc << EOF
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    50
  >  [section]
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    51
  > key=value
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    52
  > EOF
46004
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
    53
#if chg
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
    54
  $ hg showconfig
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
    55
  config error at $TESTTMP/.hg/hgrc:1: unexpected leading whitespace:  [section]
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
    56
  [255]
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
    57
#else
22276
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    58
  $ hg showconfig
45909
9dc1351d0b5f errors: raise ConfigError on failure to parse config file
Martin von Zweigbergk <martinvonz@google.com>
parents: 45846
diff changeset
    59
  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: 45846
diff changeset
    60
  [30]
46004
60523483897c tests: conditionalize return code on chg in test-config.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45909
diff changeset
    61
#endif
22276
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    62
22275
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    63
Reset hgrc
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    64
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    65
  $ echo > .hg/hgrc
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    66
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
    67
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
    68
23172
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 22367
diff changeset
    69
  $ 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
    70
  > [Section]
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 22367
diff changeset
    71
  > 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
    72
  > 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
    73
  > EOF
3425
ec6f400cff4d Use a case-sensitive version of SafeConfigParser everywhere
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    74
12082
5e2216a35839 tests: unify test-config-case
Adrian Buehlmann <adrian@cadifra.com>
parents: 4528
diff changeset
    75
  $ hg showconfig Section
5e2216a35839 tests: unify test-config-case
Adrian Buehlmann <adrian@cadifra.com>
parents: 4528
diff changeset
    76
  Section.KeY=Case Sensitive
5e2216a35839 tests: unify test-config-case
Adrian Buehlmann <adrian@cadifra.com>
parents: 4528
diff changeset
    77
  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
    78
29954
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    79
  $ hg showconfig Section -Tjson
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    80
  [
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    81
   {
42728
60789444acd6 config: fix fm.data() handling of defaultvalue
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 42727
diff changeset
    82
    "defaultvalue": null,
29954
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    83
    "name": "Section.KeY",
31006
f07ca071a058 runtests: set web.ipv6 if we use IPv6
Jun Wu <quark@fb.com>
parents: 30623
diff changeset
    84
    "source": "*.hgrc:*", (glob)
29954
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    85
    "value": "Case Sensitive"
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    86
   },
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    87
   {
42728
60789444acd6 config: fix fm.data() handling of defaultvalue
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 42727
diff changeset
    88
    "defaultvalue": null,
29954
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    89
    "name": "Section.key",
31006
f07ca071a058 runtests: set web.ipv6 if we use IPv6
Jun Wu <quark@fb.com>
parents: 30623
diff changeset
    90
    "source": "*.hgrc:*", (glob)
29954
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    91
    "value": "lower case"
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
  ]
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    94
  $ hg showconfig Section.KeY -Tjson
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    95
  [
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    96
   {
42727
049b2ac3252e config: remove pycompat.bytestr() for defaultvalue
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 42699
diff changeset
    97
    "defaultvalue": null,
29954
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
    98
    "name": "Section.KeY",
31006
f07ca071a058 runtests: set web.ipv6 if we use IPv6
Jun Wu <quark@fb.com>
parents: 30623
diff changeset
    99
    "source": "*.hgrc:*", (glob)
29954
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
   100
    "value": "Case Sensitive"
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
   101
   }
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
   102
  ]
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
   103
  $ hg showconfig -Tjson | tail -7
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
   104
   {
42728
60789444acd6 config: fix fm.data() handling of defaultvalue
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 42727
diff changeset
   105
    "defaultvalue": null,
29954
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
   106
    "name": "*", (glob)
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
   107
    "source": "*", (glob)
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
   108
    "value": "*" (glob)
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
   109
   }
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
   110
  ]
80fef5251099 config: add template support
Mathias De Maré <mathias.demare@gmail.com>
parents: 29412
diff changeset
   111
43335
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   112
Test config default of various types:
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   113
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   114
 {"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: 42728
diff changeset
   115
 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: 42728
diff changeset
   116
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   117
 dynamicdefault
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   118
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   119
  $ 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: 42728
diff changeset
   120
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   121
   {
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   122
    "name": "alias.foo",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   123
    "source": "--config",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   124
    "value": ""
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   125
   }
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   126
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   127
  $ 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: 42728
diff changeset
   128
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   129
   {"defaultvalue": ""}
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   130
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   131
  $ 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: 42728
diff changeset
   132
  
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   133
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   134
 null
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   135
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   136
  $ 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: 42728
diff changeset
   137
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   138
   {
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   139
    "defaultvalue": null,
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   140
    "name": "auth.cookiefile",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   141
    "source": "--config",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   142
    "value": ""
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   143
   }
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   144
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   145
  $ 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: 42728
diff changeset
   146
  [
43337
7e20b705da5b formatter: fix handling of None value in templater mapping
Yuya Nishihara <yuya@tcha.org>
parents: 43336
diff changeset
   147
   {"defaultvalue": null}
43335
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   148
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   149
  $ 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: 42728
diff changeset
   150
  
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   151
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   152
 false
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   153
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   154
  $ 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: 42728
diff changeset
   155
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   156
   {
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   157
    "defaultvalue": false,
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   158
    "name": "commands.commit.post-status",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   159
    "source": "--config",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   160
    "value": ""
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   161
   }
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   162
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   163
  $ 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: 42728
diff changeset
   164
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   165
   {"defaultvalue": false}
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   166
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   167
  $ 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: 42728
diff changeset
   168
  False
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   169
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   170
 true
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   171
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   172
  $ 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: 42728
diff changeset
   173
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   174
   {
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   175
    "defaultvalue": true,
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   176
    "name": "format.dotencode",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   177
    "source": "--config",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   178
    "value": ""
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   179
   }
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   180
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   181
  $ 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: 42728
diff changeset
   182
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   183
   {"defaultvalue": true}
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   184
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   185
  $ 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: 42728
diff changeset
   186
  True
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   187
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   188
 bytes
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   189
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   190
  $ 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: 42728
diff changeset
   191
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   192
   {
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   193
    "defaultvalue": "none",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   194
    "name": "commands.resolve.mark-check",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   195
    "source": "--config",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   196
    "value": ""
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   197
   }
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   198
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   199
  $ 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: 42728
diff changeset
   200
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   201
   {"defaultvalue": "none"}
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   202
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   203
  $ 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: 42728
diff changeset
   204
  none
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   205
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   206
 empty list
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   207
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   208
  $ 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: 42728
diff changeset
   209
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   210
   {
43336
a71578ec6257 config: add support for defaultvalue of list of printable elements
Yuya Nishihara <yuya@tcha.org>
parents: 43335
diff changeset
   211
    "defaultvalue": [],
43335
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   212
    "name": "commands.show.aliasprefix",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   213
    "source": "--config",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   214
    "value": ""
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   215
   }
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   216
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   217
  $ 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: 42728
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": []}
43335
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   220
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   221
  $ 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: 42728
diff changeset
   222
  
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   223
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   224
 nonempty list
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   225
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   226
  $ 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: 42728
diff changeset
   227
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   228
   {
43336
a71578ec6257 config: add support for defaultvalue of list of printable elements
Yuya Nishihara <yuya@tcha.org>
parents: 43335
diff changeset
   229
    "defaultvalue": ["topic", "bar", "number", "estimate"],
43335
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   230
    "name": "progress.format",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   231
    "source": "--config",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   232
    "value": ""
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   233
   }
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   234
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   235
  $ 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: 42728
diff changeset
   236
  [
43336
a71578ec6257 config: add support for defaultvalue of list of printable elements
Yuya Nishihara <yuya@tcha.org>
parents: 43335
diff changeset
   237
   {"defaultvalue": ["topic", "bar", "number", "estimate"]}
43335
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   238
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   239
  $ 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
   240
  topic bar number estimate
43335
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   241
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   242
 int
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   243
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   244
  $ 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: 42728
diff changeset
   245
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   246
   {
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   247
    "defaultvalue": 1000,
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   248
    "name": "profiling.freq",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   249
    "source": "--config",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   250
    "value": ""
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   251
   }
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   252
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   253
  $ 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: 42728
diff changeset
   254
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   255
   {"defaultvalue": 1000}
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   256
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   257
  $ 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: 42728
diff changeset
   258
  1000
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   259
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   260
 float
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   261
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   262
  $ 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: 42728
diff changeset
   263
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   264
   {
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   265
    "defaultvalue": 0.999,
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   266
    "name": "profiling.showmax",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   267
    "source": "--config",
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   268
    "value": ""
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   269
   }
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   270
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   271
  $ 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: 42728
diff changeset
   272
  [
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   273
   {"defaultvalue": 0.999}
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   274
  ]
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   275
  $ 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: 42728
diff changeset
   276
  0.999
242ad45b60b3 config: fix -Tjson to not crash due to unsupported defaultvalue types
Yuya Nishihara <yuya@tcha.org>
parents: 42728
diff changeset
   277
30623
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   278
Test empty config source:
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   279
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   280
  $ cat <<EOF > emptysource.py
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   281
  > def reposetup(ui, repo):
36753
a22915edc279 py3: byte-stringify test-config.t and test-config-env.py
Yuya Nishihara <yuya@tcha.org>
parents: 35400
diff changeset
   282
  >     ui.setconfig(b'empty', b'source', b'value')
30623
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   283
  > EOF
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   284
  $ cp .hg/hgrc .hg/hgrc.orig
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   285
  $ cat <<EOF >> .hg/hgrc
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   286
  > [extensions]
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   287
  > emptysource = `pwd`/emptysource.py
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   288
  > EOF
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   289
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   290
  $ hg config --debug empty.source
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   291
  read config from: * (glob)
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   292
  none: value
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   293
  $ hg config empty.source -Tjson
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   294
  [
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   295
   {
42727
049b2ac3252e config: remove pycompat.bytestr() for defaultvalue
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 42699
diff changeset
   296
    "defaultvalue": null,
30623
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   297
    "name": "empty.source",
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   298
    "source": "",
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   299
    "value": "value"
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   300
   }
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   301
  ]
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   302
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   303
  $ cp .hg/hgrc.orig .hg/hgrc
201b44c8875c ui: do not translate empty configsource() to 'none' (API)
Yuya Nishihara <yuya@tcha.org>
parents: 29954
diff changeset
   304
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
   305
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
   306
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
  $ 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
   308
  > [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
   309
  > 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
   310
  > %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
   311
  > 
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
  > 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
   313
  > 
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
  > 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
   315
  > 
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
  > 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
   317
  > 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
   318
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
  $ 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
   320
  > [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
   321
  > 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
   322
  > %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
   323
  > 
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
  > %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
   325
  > 
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   326
  > 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
   327
  > %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
   328
  > 
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   329
  > 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
   330
  > %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
   331
  > 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
   332
  > 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
   333
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
   334
  $ 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
   335
  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
   336
816be4ca4ae2 config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents: 19087
diff changeset
   337
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
   338
816be4ca4ae2 config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents: 19087
diff changeset
   339
  $ hg config Section.idontexist
816be4ca4ae2 config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents: 19087
diff changeset
   340
  [1]
29412
b62bce819d0c ui: don't fixup [paths] sub-options
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23348
diff changeset
   341
b62bce819d0c ui: don't fixup [paths] sub-options
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23348
diff changeset
   342
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
   343
b62bce819d0c ui: don't fixup [paths] sub-options
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23348
diff changeset
   344
  $ cat > .hg/hgrc << EOF
b62bce819d0c ui: don't fixup [paths] sub-options
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23348
diff changeset
   345
  > [paths]
b62bce819d0c ui: don't fixup [paths] sub-options
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23348
diff changeset
   346
  > foo = ~/foo
b62bce819d0c ui: don't fixup [paths] sub-options
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23348
diff changeset
   347
  > foo:suboption = ~/foo
b62bce819d0c ui: don't fixup [paths] sub-options
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23348
diff changeset
   348
  > EOF
b62bce819d0c ui: don't fixup [paths] sub-options
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23348
diff changeset
   349
b62bce819d0c ui: don't fixup [paths] sub-options
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23348
diff changeset
   350
  $ hg showconfig paths
b62bce819d0c ui: don't fixup [paths] sub-options
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23348
diff changeset
   351
  paths.foo:suboption=~/foo
b62bce819d0c ui: don't fixup [paths] sub-options
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23348
diff changeset
   352
  paths.foo=$TESTTMP/foo
31125
3f8f53190d6a chg: deduplicate error handling of ui.system()
Yuya Nishihara <yuya@tcha.org>
parents: 31006
diff changeset
   353
3f8f53190d6a chg: deduplicate error handling of ui.system()
Yuya Nishihara <yuya@tcha.org>
parents: 31006
diff changeset
   354
edit failure
3f8f53190d6a chg: deduplicate error handling of ui.system()
Yuya Nishihara <yuya@tcha.org>
parents: 31006
diff changeset
   355
3f8f53190d6a chg: deduplicate error handling of ui.system()
Yuya Nishihara <yuya@tcha.org>
parents: 31006
diff changeset
   356
  $ HGEDITOR=false hg config --edit
3f8f53190d6a chg: deduplicate error handling of ui.system()
Yuya Nishihara <yuya@tcha.org>
parents: 31006
diff changeset
   357
  abort: edit failed: false exited with status 1
45846
8d72e29ad1e0 errors: introduce InputError and use it from commands and cmdutil
Martin von Zweigbergk <martinvonz@google.com>
parents: 45800
diff changeset
   358
  [10]
31690
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31125
diff changeset
   359
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31125
diff changeset
   360
config affected by environment variables
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31125
diff changeset
   361
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31125
diff changeset
   362
  $ EDITOR=e1 VISUAL=e2 hg config --debug | grep 'ui\.editor'
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31125
diff changeset
   363
  $VISUAL: ui.editor=e2
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31125
diff changeset
   364
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31125
diff changeset
   365
  $ VISUAL=e2 hg config --debug --config ui.editor=e3 | grep 'ui\.editor'
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31125
diff changeset
   366
  --config: ui.editor=e3
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31125
diff changeset
   367
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31125
diff changeset
   368
  $ PAGER=p1 hg config --debug | grep 'pager\.pager'
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31125
diff changeset
   369
  $PAGER: pager.pager=p1
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31125
diff changeset
   370
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31125
diff changeset
   371
  $ PAGER=p1 hg config --debug --config pager.pager=p2 | grep 'pager\.pager'
d83e51654c8a rcutil: let environ override system configs (BC)
Jun Wu <quark@fb.com>
parents: 31125
diff changeset
   372
  --config: pager.pager=p2
33329
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   373
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   374
verify that aliases are evaluated as well
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   375
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   376
  $ hg init aliastest
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   377
  $ cd aliastest
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   378
  $ cat > .hg/hgrc << EOF
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   379
  > [ui]
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   380
  > user = repo user
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   381
  > EOF
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   382
  $ touch index
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   383
  $ unset HGUSER
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   384
  $ hg ci -Am test
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   385
  adding index
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   386
  $ hg log --template '{author}\n'
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   387
  repo user
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   388
  $ cd ..
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   389
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   390
alias has lower priority
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   391
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   392
  $ hg init aliaspriority
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   393
  $ cd aliaspriority
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   394
  $ cat > .hg/hgrc << EOF
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   395
  > [ui]
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   396
  > user = alias user
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   397
  > username = repo user
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   398
  > EOF
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   399
  $ touch index
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   400
  $ unset HGUSER
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   401
  $ hg ci -Am test
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   402
  adding index
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   403
  $ hg log --template '{author}\n'
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   404
  repo user
e714159860fd configitems: add alias support in config
David Demelier <demelier.david@gmail.com>
parents: 31690
diff changeset
   405
  $ cd ..
42093
edbcf5b239f9 config: read configs from directories in lexicographical order
Martin von Zweigbergk <martinvonz@google.com>
parents: 36753
diff changeset
   406
edbcf5b239f9 config: read configs from directories in lexicographical order
Martin von Zweigbergk <martinvonz@google.com>
parents: 36753
diff changeset
   407
configs should be read in lexicographical order
edbcf5b239f9 config: read configs from directories in lexicographical order
Martin von Zweigbergk <martinvonz@google.com>
parents: 36753
diff changeset
   408
edbcf5b239f9 config: read configs from directories in lexicographical order
Martin von Zweigbergk <martinvonz@google.com>
parents: 36753
diff changeset
   409
  $ mkdir configs
edbcf5b239f9 config: read configs from directories in lexicographical order
Martin von Zweigbergk <martinvonz@google.com>
parents: 36753
diff changeset
   410
  $ 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: 36753
diff changeset
   411
  >    printf "[section]\nkey=$i" > configs/$i.rc
edbcf5b239f9 config: read configs from directories in lexicographical order
Martin von Zweigbergk <martinvonz@google.com>
parents: 36753
diff changeset
   412
  > done
edbcf5b239f9 config: read configs from directories in lexicographical order
Martin von Zweigbergk <martinvonz@google.com>
parents: 36753
diff changeset
   413
  $ HGRCPATH=configs hg config section.key
edbcf5b239f9 config: read configs from directories in lexicographical order
Martin von Zweigbergk <martinvonz@google.com>
parents: 36753
diff changeset
   414
  99