tests/test-status-color.t
author Simon Sapin <simon.sapin@octobus.net>
Tue, 09 Nov 2021 19:55:46 +0100
changeset 48335 b7fde9237c92
parent 46262 9c9e0b4b2ca7
child 48340 d71b9902e2de
permissions -rw-r--r--
rhg: Enable `rhg status` in most tests This subcommand is disabled by default because of bugs that make some test fail. Enable it in the rest of the tests in order to avoid regressing them. As with `RHG_ON_UNSUPPORTED`, an environment variable is used instead of a configuration file and `HGRCPATH` because some tests override `HGRCPATH`. Running `unset RHG_STATUS` at the start of a test restores the default of `rhg status` being disabled. Hopefully it can be increasingly removed from test files as bugs are fixed. Differential Revision: https://phab.mercurial-scm.org/D11756
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48335
b7fde9237c92 rhg: Enable `rhg status` in most tests
Simon Sapin <simon.sapin@octobus.net>
parents: 46262
diff changeset
     1
TODO: fix rhg bugs that make this test fail when status is enabled
b7fde9237c92 rhg: Enable `rhg status` in most tests
Simon Sapin <simon.sapin@octobus.net>
parents: 46262
diff changeset
     2
  $ unset RHG_STATUS
b7fde9237c92 rhg: Enable `rhg status` in most tests
Simon Sapin <simon.sapin@octobus.net>
parents: 46262
diff changeset
     3
b7fde9237c92 rhg: Enable `rhg status` in most tests
Simon Sapin <simon.sapin@octobus.net>
parents: 46262
diff changeset
     4
23172
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 22763
diff changeset
     5
  $ cat <<EOF >> $HGRCPATH
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
     6
  > [ui]
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
     7
  > color = always
23172
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 22763
diff changeset
     8
  > [color]
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 22763
diff changeset
     9
  > mode = ansi
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 22763
diff changeset
    10
  > EOF
13997
b083d00578bf test-status-color: fix terminfo code compatibility problem
Patrick Mezard <pmezard@gmail.com>
parents: 13987
diff changeset
    11
Terminfo codes compatibility fix
b083d00578bf test-status-color: fix terminfo code compatibility problem
Patrick Mezard <pmezard@gmail.com>
parents: 13987
diff changeset
    12
  $ echo "color.none=0" >> $HGRCPATH
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
    13
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
    14
  $ hg init repo1
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
    15
  $ cd repo1
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
    16
  $ mkdir a b a/1 b/1 b/2
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
    17
  $ touch in_root a/in_a b/in_b a/1/in_a_1 b/1/in_b_1 b/2/in_b_2
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
    18
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
    19
hg status in repo root:
7458
03dd55115985 color: Add tests for colorized diff and status output.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    20
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
    21
  $ hg status
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    22
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    23
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    24
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    25
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    26
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    27
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
    28
22463
1c4ae0f6a30f color: enable debug option to show labels
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 21227
diff changeset
    29
  $ hg status --color=debug
22464
964dd1c491ca color: change the debug output format
Matt Mackall <mpm@selenic.com>
parents: 22463
diff changeset
    30
  [status.unknown|? ][status.unknown|a/1/in_a_1]
964dd1c491ca color: change the debug output format
Matt Mackall <mpm@selenic.com>
parents: 22463
diff changeset
    31
  [status.unknown|? ][status.unknown|a/in_a]
964dd1c491ca color: change the debug output format
Matt Mackall <mpm@selenic.com>
parents: 22463
diff changeset
    32
  [status.unknown|? ][status.unknown|b/1/in_b_1]
964dd1c491ca color: change the debug output format
Matt Mackall <mpm@selenic.com>
parents: 22463
diff changeset
    33
  [status.unknown|? ][status.unknown|b/2/in_b_2]
964dd1c491ca color: change the debug output format
Matt Mackall <mpm@selenic.com>
parents: 22463
diff changeset
    34
  [status.unknown|? ][status.unknown|b/in_b]
964dd1c491ca color: change the debug output format
Matt Mackall <mpm@selenic.com>
parents: 22463
diff changeset
    35
  [status.unknown|? ][status.unknown|in_root]
35181
d4805a5e7e70 color: respect HGPLAINEXCEPT=color to allow colors while scripting (issue5749)
Augie Fackler <augie@google.com>
parents: 32103
diff changeset
    36
HGPLAIN disables color
d4805a5e7e70 color: respect HGPLAINEXCEPT=color to allow colors while scripting (issue5749)
Augie Fackler <augie@google.com>
parents: 32103
diff changeset
    37
  $ HGPLAIN=1 hg status --color=debug
35205
8feef8ef8389 tests: trivial fixes for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35181
diff changeset
    38
  ? a/1/in_a_1 (glob)
8feef8ef8389 tests: trivial fixes for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35181
diff changeset
    39
  ? a/in_a (glob)
8feef8ef8389 tests: trivial fixes for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35181
diff changeset
    40
  ? b/1/in_b_1 (glob)
8feef8ef8389 tests: trivial fixes for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35181
diff changeset
    41
  ? b/2/in_b_2 (glob)
8feef8ef8389 tests: trivial fixes for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35181
diff changeset
    42
  ? b/in_b (glob)
35181
d4805a5e7e70 color: respect HGPLAINEXCEPT=color to allow colors while scripting (issue5749)
Augie Fackler <augie@google.com>
parents: 32103
diff changeset
    43
  ? in_root
d4805a5e7e70 color: respect HGPLAINEXCEPT=color to allow colors while scripting (issue5749)
Augie Fackler <augie@google.com>
parents: 32103
diff changeset
    44
HGPLAINEXCEPT=color does not disable color
d4805a5e7e70 color: respect HGPLAINEXCEPT=color to allow colors while scripting (issue5749)
Augie Fackler <augie@google.com>
parents: 32103
diff changeset
    45
  $ HGPLAINEXCEPT=color hg status --color=debug
35205
8feef8ef8389 tests: trivial fixes for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35181
diff changeset
    46
  [status.unknown|? ][status.unknown|a/1/in_a_1] (glob)
8feef8ef8389 tests: trivial fixes for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35181
diff changeset
    47
  [status.unknown|? ][status.unknown|a/in_a] (glob)
8feef8ef8389 tests: trivial fixes for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35181
diff changeset
    48
  [status.unknown|? ][status.unknown|b/1/in_b_1] (glob)
8feef8ef8389 tests: trivial fixes for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35181
diff changeset
    49
  [status.unknown|? ][status.unknown|b/2/in_b_2] (glob)
8feef8ef8389 tests: trivial fixes for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35181
diff changeset
    50
  [status.unknown|? ][status.unknown|b/in_b] (glob)
35181
d4805a5e7e70 color: respect HGPLAINEXCEPT=color to allow colors while scripting (issue5749)
Augie Fackler <augie@google.com>
parents: 32103
diff changeset
    51
  [status.unknown|? ][status.unknown|in_root]
22463
1c4ae0f6a30f color: enable debug option to show labels
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 21227
diff changeset
    52
28384
3356bf61fa25 formatter: make labels work with templated output
Kostia Balytskyi <ikostia@fb.com>
parents: 26618
diff changeset
    53
hg status with template
3356bf61fa25 formatter: make labels work with templated output
Kostia Balytskyi <ikostia@fb.com>
parents: 26618
diff changeset
    54
  $ hg status -T "{label('red', path)}\n" --color=debug
3356bf61fa25 formatter: make labels work with templated output
Kostia Balytskyi <ikostia@fb.com>
parents: 26618
diff changeset
    55
  [red|a/1/in_a_1]
3356bf61fa25 formatter: make labels work with templated output
Kostia Balytskyi <ikostia@fb.com>
parents: 26618
diff changeset
    56
  [red|a/in_a]
3356bf61fa25 formatter: make labels work with templated output
Kostia Balytskyi <ikostia@fb.com>
parents: 26618
diff changeset
    57
  [red|b/1/in_b_1]
3356bf61fa25 formatter: make labels work with templated output
Kostia Balytskyi <ikostia@fb.com>
parents: 26618
diff changeset
    58
  [red|b/2/in_b_2]
3356bf61fa25 formatter: make labels work with templated output
Kostia Balytskyi <ikostia@fb.com>
parents: 26618
diff changeset
    59
  [red|b/in_b]
3356bf61fa25 formatter: make labels work with templated output
Kostia Balytskyi <ikostia@fb.com>
parents: 26618
diff changeset
    60
  [red|in_root]
3356bf61fa25 formatter: make labels work with templated output
Kostia Balytskyi <ikostia@fb.com>
parents: 26618
diff changeset
    61
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
    62
hg status . in repo root:
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
    63
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
    64
  $ hg status .
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    65
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    66
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    67
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    68
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    69
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    70
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
7458
03dd55115985 color: Add tests for colorized diff and status output.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    71
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
    72
  $ hg status --cwd a
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    73
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    74
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    75
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    76
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    77
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    78
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
    79
  $ hg status --cwd a .
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    80
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m1/in_a_1\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    81
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_a\x1b[0m (esc)
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
    82
  $ hg status --cwd a ..
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    83
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m1/in_a_1\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    84
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_a\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    85
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../b/1/in_b_1\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    86
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../b/2/in_b_2\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    87
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../b/in_b\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    88
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_root\x1b[0m (esc)
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
    89
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
    90
  $ hg status --cwd b
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    91
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    92
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    93
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    94
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    95
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    96
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
    97
  $ hg status --cwd b .
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    98
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m1/in_b_1\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
    99
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m2/in_b_2\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   100
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b\x1b[0m (esc)
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
   101
  $ hg status --cwd b ..
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   102
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../a/1/in_a_1\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   103
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../a/in_a\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   104
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m1/in_b_1\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   105
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m2/in_b_2\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   106
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   107
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_root\x1b[0m (esc)
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   108
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
   109
  $ hg status --cwd a/1
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   110
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   111
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   112
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   113
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   114
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   115
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
   116
  $ hg status --cwd a/1 .
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   117
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_a_1\x1b[0m (esc)
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
   118
  $ hg status --cwd a/1 ..
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   119
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_a_1\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   120
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_a\x1b[0m (esc)
7458
03dd55115985 color: Add tests for colorized diff and status output.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
   121
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
   122
  $ hg status --cwd b/1
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   123
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   124
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   125
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   126
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   127
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   128
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
   129
  $ hg status --cwd b/1 .
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   130
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b_1\x1b[0m (esc)
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
   131
  $ hg status --cwd b/1 ..
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   132
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b_1\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   133
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../2/in_b_2\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   134
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_b\x1b[0m (esc)
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   135
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
   136
  $ hg status --cwd b/2
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   137
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   138
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   139
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   140
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   141
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   142
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
   143
  $ hg status --cwd b/2 .
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   144
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b_2\x1b[0m (esc)
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
   145
  $ hg status --cwd b/2 ..
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   146
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../1/in_b_1\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   147
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b_2\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   148
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_b\x1b[0m (esc)
19073
d78d0256198e color: set _colormode to None when mode is unset (issue3895)
Siddharth Agarwal <sid0@fb.com>
parents: 17910
diff changeset
   149
d78d0256198e color: set _colormode to None when mode is unset (issue3895)
Siddharth Agarwal <sid0@fb.com>
parents: 17910
diff changeset
   150
Make sure --color=never works
d78d0256198e color: set _colormode to None when mode is unset (issue3895)
Siddharth Agarwal <sid0@fb.com>
parents: 17910
diff changeset
   151
  $ hg status --color=never
d78d0256198e color: set _colormode to None when mode is unset (issue3895)
Siddharth Agarwal <sid0@fb.com>
parents: 17910
diff changeset
   152
  ? a/1/in_a_1
d78d0256198e color: set _colormode to None when mode is unset (issue3895)
Siddharth Agarwal <sid0@fb.com>
parents: 17910
diff changeset
   153
  ? a/in_a
d78d0256198e color: set _colormode to None when mode is unset (issue3895)
Siddharth Agarwal <sid0@fb.com>
parents: 17910
diff changeset
   154
  ? b/1/in_b_1
d78d0256198e color: set _colormode to None when mode is unset (issue3895)
Siddharth Agarwal <sid0@fb.com>
parents: 17910
diff changeset
   155
  ? b/2/in_b_2
d78d0256198e color: set _colormode to None when mode is unset (issue3895)
Siddharth Agarwal <sid0@fb.com>
parents: 17910
diff changeset
   156
  ? b/in_b
d78d0256198e color: set _colormode to None when mode is unset (issue3895)
Siddharth Agarwal <sid0@fb.com>
parents: 17910
diff changeset
   157
  ? in_root
d78d0256198e color: set _colormode to None when mode is unset (issue3895)
Siddharth Agarwal <sid0@fb.com>
parents: 17910
diff changeset
   158
19074
a1922b9a2cad color: add a test with extension loaded and ui.formatted=False
Siddharth Agarwal <sid0@fb.com>
parents: 19073
diff changeset
   159
Make sure ui.formatted=False works
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
   160
  $ hg status --color=auto --config ui.formatted=False
19074
a1922b9a2cad color: add a test with extension loaded and ui.formatted=False
Siddharth Agarwal <sid0@fb.com>
parents: 19073
diff changeset
   161
  ? a/1/in_a_1
a1922b9a2cad color: add a test with extension loaded and ui.formatted=False
Siddharth Agarwal <sid0@fb.com>
parents: 19073
diff changeset
   162
  ? a/in_a
a1922b9a2cad color: add a test with extension loaded and ui.formatted=False
Siddharth Agarwal <sid0@fb.com>
parents: 19073
diff changeset
   163
  ? b/1/in_b_1
a1922b9a2cad color: add a test with extension loaded and ui.formatted=False
Siddharth Agarwal <sid0@fb.com>
parents: 19073
diff changeset
   164
  ? b/2/in_b_2
a1922b9a2cad color: add a test with extension loaded and ui.formatted=False
Siddharth Agarwal <sid0@fb.com>
parents: 19073
diff changeset
   165
  ? b/in_b
a1922b9a2cad color: add a test with extension loaded and ui.formatted=False
Siddharth Agarwal <sid0@fb.com>
parents: 19073
diff changeset
   166
  ? in_root
a1922b9a2cad color: add a test with extension loaded and ui.formatted=False
Siddharth Agarwal <sid0@fb.com>
parents: 19073
diff changeset
   167
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   168
  $ cd ..
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   169
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   170
  $ hg init repo2
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   171
  $ cd repo2
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   172
  $ touch modified removed deleted ignored
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   173
  $ echo "^ignored$" > .hgignore
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11783
diff changeset
   174
  $ hg ci -A -m 'initial checkin'
39091
ddc1da134772 addremove: add associated color for the new labels
Boris Feld <boris.feld@octobus.net>
parents: 38787
diff changeset
   175
  \x1b[0;32madding .hgignore\x1b[0m (esc)
ddc1da134772 addremove: add associated color for the new labels
Boris Feld <boris.feld@octobus.net>
parents: 38787
diff changeset
   176
  \x1b[0;32madding deleted\x1b[0m (esc)
ddc1da134772 addremove: add associated color for the new labels
Boris Feld <boris.feld@octobus.net>
parents: 38787
diff changeset
   177
  \x1b[0;32madding modified\x1b[0m (esc)
ddc1da134772 addremove: add associated color for the new labels
Boris Feld <boris.feld@octobus.net>
parents: 38787
diff changeset
   178
  \x1b[0;32madding removed\x1b[0m (esc)
22463
1c4ae0f6a30f color: enable debug option to show labels
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 21227
diff changeset
   179
  $ hg log --color=debug
22464
964dd1c491ca color: change the debug output format
Matt Mackall <mpm@selenic.com>
parents: 22463
diff changeset
   180
  [log.changeset changeset.draft|changeset:   0:389aef86a55e]
964dd1c491ca color: change the debug output format
Matt Mackall <mpm@selenic.com>
parents: 22463
diff changeset
   181
  [log.tag|tag:         tip]
964dd1c491ca color: change the debug output format
Matt Mackall <mpm@selenic.com>
parents: 22463
diff changeset
   182
  [log.user|user:        test]
964dd1c491ca color: change the debug output format
Matt Mackall <mpm@selenic.com>
parents: 22463
diff changeset
   183
  [log.date|date:        Thu Jan 01 00:00:00 1970 +0000]
964dd1c491ca color: change the debug output format
Matt Mackall <mpm@selenic.com>
parents: 22463
diff changeset
   184
  [log.summary|summary:     initial checkin]
22463
1c4ae0f6a30f color: enable debug option to show labels
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 21227
diff changeset
   185
  
28827
1e184241de51 compact: add color labels to -Tcompact
timeless <timeless@mozdev.org>
parents: 28384
diff changeset
   186
  $ hg log -Tcompact --color=debug
1e184241de51 compact: add color labels to -Tcompact
timeless <timeless@mozdev.org>
parents: 28384
diff changeset
   187
  [log.changeset changeset.draft|0][tip]   [log.node|389aef86a55e]   [log.date|1970-01-01 00:00 +0000]   [log.user|test]
1e184241de51 compact: add color labels to -Tcompact
timeless <timeless@mozdev.org>
parents: 28384
diff changeset
   188
    [ui.note log.description|initial checkin]
1e184241de51 compact: add color labels to -Tcompact
timeless <timeless@mozdev.org>
parents: 28384
diff changeset
   189
  
22763
7ebf91426f6a color: omit debug label output on empty strings
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 22464
diff changeset
   190
Labels on empty strings should not be displayed, labels on custom
7ebf91426f6a color: omit debug label output on empty strings
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 22464
diff changeset
   191
templates should be.
7ebf91426f6a color: omit debug label output on empty strings
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 22464
diff changeset
   192
7ebf91426f6a color: omit debug label output on empty strings
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 22464
diff changeset
   193
  $ hg log --color=debug -T '{label("my.label",author)}\n{label("skipped.label","")}'
7ebf91426f6a color: omit debug label output on empty strings
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 22464
diff changeset
   194
  [my.label|test]
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   195
  $ touch modified added unknown ignored
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   196
  $ hg add added
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   197
  $ hg remove removed
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   198
  $ rm deleted
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   199
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   200
hg status:
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   201
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
   202
  $ hg status
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   203
  \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   204
  \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   205
  \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   206
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   207
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   208
hg status modified added removed deleted unknown never-existed ignored:
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   209
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
   210
  $ hg status modified added removed deleted unknown never-existed ignored
15521
117f9190c1ba tests: hide 'No such file or directory' messages
Mads Kiilerich <mads@kiilerich.com>
parents: 14757
diff changeset
   211
  never-existed: * (glob)
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   212
  \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   213
  \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   214
  \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   215
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   216
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   217
  $ hg copy modified copied
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   218
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   219
hg status -C:
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   220
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
   221
  $ hg status -C
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   222
  \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   223
  \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc)
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
   224
  \x1b[0;0m  modified\x1b[0m (esc)
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   225
  \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   226
  \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   227
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   228
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   229
hg status -A:
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   230
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
   231
  $ hg status -A
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   232
  \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   233
  \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc)
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
   234
  \x1b[0;0m  modified\x1b[0m (esc)
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   235
  \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   236
  \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   237
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   238
  \x1b[0;30;1mI \x1b[0m\x1b[0;30;1mignored\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   239
  \x1b[0;0mC \x1b[0m\x1b[0;0m.hgignore\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   240
  \x1b[0;0mC \x1b[0m\x1b[0;0mmodified\x1b[0m (esc)
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   241
20387
16c643f3a1a5 tests: use small conditional section for tic requirement in test-status-color.t
Mads Kiilerich <madski@unity3d.com>
parents: 19074
diff changeset
   242
13987
e0f07847f8de color: add support for terminfo-based attributes and color
Danek Duvall <duvall@comfychair.org>
parents: 12942
diff changeset
   243
hg status -A (with terminfo color):
e0f07847f8de color: add support for terminfo-based attributes and color
Danek Duvall <duvall@comfychair.org>
parents: 12942
diff changeset
   244
20387
16c643f3a1a5 tests: use small conditional section for tic requirement in test-status-color.t
Mads Kiilerich <madski@unity3d.com>
parents: 19074
diff changeset
   245
#if tic
16c643f3a1a5 tests: use small conditional section for tic requirement in test-status-color.t
Mads Kiilerich <madski@unity3d.com>
parents: 19074
diff changeset
   246
40097
34d9846023e6 tests: deal with differences in tic from ncurses and NetBSD
Joerg Sonnenberger <joerg@bec.de>
parents: 39091
diff changeset
   247
  $ tic -o "$TESTTMP/terminfo" "$TESTDIR/hgterm.ti"
34d9846023e6 tests: deal with differences in tic from ncurses and NetBSD
Joerg Sonnenberger <joerg@bec.de>
parents: 39091
diff changeset
   248
  $ ln -s "$TESTTMP/terminfo" "$TESTTMP/terminfo.cdb"
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
   249
  $ TERM=hgterm TERMINFO="$TESTTMP/terminfo" hg status --config color.mode=terminfo -A
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   250
  \x1b[30m\x1b[32m\x1b[1mA \x1b[30m\x1b[30m\x1b[32m\x1b[1madded\x1b[30m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   251
  \x1b[30m\x1b[32m\x1b[1mA \x1b[30m\x1b[30m\x1b[32m\x1b[1mcopied\x1b[30m (esc)
13997
b083d00578bf test-status-color: fix terminfo code compatibility problem
Patrick Mezard <pmezard@gmail.com>
parents: 13987
diff changeset
   252
  \x1b[30m\x1b[30m  modified\x1b[30m (esc)
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   253
  \x1b[30m\x1b[31m\x1b[1mR \x1b[30m\x1b[30m\x1b[31m\x1b[1mremoved\x1b[30m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   254
  \x1b[30m\x1b[36m\x1b[1m\x1b[4m! \x1b[30m\x1b[30m\x1b[36m\x1b[1m\x1b[4mdeleted\x1b[30m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   255
  \x1b[30m\x1b[35m\x1b[1m\x1b[4m? \x1b[30m\x1b[30m\x1b[35m\x1b[1m\x1b[4munknown\x1b[30m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   256
  \x1b[30m\x1b[30m\x1b[1mI \x1b[30m\x1b[30m\x1b[30m\x1b[1mignored\x1b[30m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   257
  \x1b[30m\x1b[30mC \x1b[30m\x1b[30m\x1b[30m.hgignore\x1b[30m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   258
  \x1b[30m\x1b[30mC \x1b[30m\x1b[30m\x1b[30mmodified\x1b[30m (esc)
13987
e0f07847f8de color: add support for terminfo-based attributes and color
Danek Duvall <duvall@comfychair.org>
parents: 12942
diff changeset
   259
30173
f34a8cff51d9 color: allow for user-configurable terminfo codes for effects
Danek Duvall <danek.duvall@oracle.com>
parents: 28827
diff changeset
   260
The user can define effects with raw terminfo codes:
f34a8cff51d9 color: allow for user-configurable terminfo codes for effects
Danek Duvall <danek.duvall@oracle.com>
parents: 28827
diff changeset
   261
f34a8cff51d9 color: allow for user-configurable terminfo codes for effects
Danek Duvall <danek.duvall@oracle.com>
parents: 28827
diff changeset
   262
  $ cat <<EOF >> $HGRCPATH
f34a8cff51d9 color: allow for user-configurable terminfo codes for effects
Danek Duvall <danek.duvall@oracle.com>
parents: 28827
diff changeset
   263
  > # Completely bogus code for dim
f34a8cff51d9 color: allow for user-configurable terminfo codes for effects
Danek Duvall <danek.duvall@oracle.com>
parents: 28827
diff changeset
   264
  > terminfo.dim = \E[88m
f34a8cff51d9 color: allow for user-configurable terminfo codes for effects
Danek Duvall <danek.duvall@oracle.com>
parents: 28827
diff changeset
   265
  > # We can override what's in the terminfo database, too
f34a8cff51d9 color: allow for user-configurable terminfo codes for effects
Danek Duvall <danek.duvall@oracle.com>
parents: 28827
diff changeset
   266
  > terminfo.bold = \E[2m
f34a8cff51d9 color: allow for user-configurable terminfo codes for effects
Danek Duvall <danek.duvall@oracle.com>
parents: 28827
diff changeset
   267
  > EOF
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
   268
  $ TERM=hgterm TERMINFO="$TESTTMP/terminfo" hg status --config color.mode=terminfo --config color.status.clean=dim -A
30173
f34a8cff51d9 color: allow for user-configurable terminfo codes for effects
Danek Duvall <danek.duvall@oracle.com>
parents: 28827
diff changeset
   269
  \x1b[30m\x1b[32m\x1b[2mA \x1b[30m\x1b[30m\x1b[32m\x1b[2madded\x1b[30m (esc)
f34a8cff51d9 color: allow for user-configurable terminfo codes for effects
Danek Duvall <danek.duvall@oracle.com>
parents: 28827
diff changeset
   270
  \x1b[30m\x1b[32m\x1b[2mA \x1b[30m\x1b[30m\x1b[32m\x1b[2mcopied\x1b[30m (esc)
f34a8cff51d9 color: allow for user-configurable terminfo codes for effects
Danek Duvall <danek.duvall@oracle.com>
parents: 28827
diff changeset
   271
  \x1b[30m\x1b[30m  modified\x1b[30m (esc)
f34a8cff51d9 color: allow for user-configurable terminfo codes for effects
Danek Duvall <danek.duvall@oracle.com>
parents: 28827
diff changeset
   272
  \x1b[30m\x1b[31m\x1b[2mR \x1b[30m\x1b[30m\x1b[31m\x1b[2mremoved\x1b[30m (esc)
f34a8cff51d9 color: allow for user-configurable terminfo codes for effects
Danek Duvall <danek.duvall@oracle.com>
parents: 28827
diff changeset
   273
  \x1b[30m\x1b[36m\x1b[2m\x1b[4m! \x1b[30m\x1b[30m\x1b[36m\x1b[2m\x1b[4mdeleted\x1b[30m (esc)
f34a8cff51d9 color: allow for user-configurable terminfo codes for effects
Danek Duvall <danek.duvall@oracle.com>
parents: 28827
diff changeset
   274
  \x1b[30m\x1b[35m\x1b[2m\x1b[4m? \x1b[30m\x1b[30m\x1b[35m\x1b[2m\x1b[4munknown\x1b[30m (esc)
f34a8cff51d9 color: allow for user-configurable terminfo codes for effects
Danek Duvall <danek.duvall@oracle.com>
parents: 28827
diff changeset
   275
  \x1b[30m\x1b[30m\x1b[2mI \x1b[30m\x1b[30m\x1b[30m\x1b[2mignored\x1b[30m (esc)
f34a8cff51d9 color: allow for user-configurable terminfo codes for effects
Danek Duvall <danek.duvall@oracle.com>
parents: 28827
diff changeset
   276
  \x1b[30m\x1b[88mC \x1b[30m\x1b[30m\x1b[88m.hgignore\x1b[30m (esc)
f34a8cff51d9 color: allow for user-configurable terminfo codes for effects
Danek Duvall <danek.duvall@oracle.com>
parents: 28827
diff changeset
   277
  \x1b[30m\x1b[88mC \x1b[30m\x1b[30m\x1b[88mmodified\x1b[30m (esc)
f34a8cff51d9 color: allow for user-configurable terminfo codes for effects
Danek Duvall <danek.duvall@oracle.com>
parents: 28827
diff changeset
   278
20387
16c643f3a1a5 tests: use small conditional section for tic requirement in test-status-color.t
Mads Kiilerich <madski@unity3d.com>
parents: 19074
diff changeset
   279
#endif
16c643f3a1a5 tests: use small conditional section for tic requirement in test-status-color.t
Mads Kiilerich <madski@unity3d.com>
parents: 19074
diff changeset
   280
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   281
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   282
  $ echo "^ignoreddir$" > .hgignore
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   283
  $ mkdir ignoreddir
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   284
  $ touch ignoreddir/file
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   285
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   286
hg status ignoreddir/file:
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   287
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
   288
  $ hg status ignoreddir/file
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   289
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   290
hg status -i ignoreddir/file:
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   291
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
   292
  $ hg status -i ignoreddir/file
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   293
  \x1b[0;30;1mI \x1b[0m\x1b[0;30;1mignoreddir/file\x1b[0m (esc)
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   294
  $ cd ..
7458
03dd55115985 color: Add tests for colorized diff and status output.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
   295
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12316
diff changeset
   296
check 'status -q' and some combinations
7458
03dd55115985 color: Add tests for colorized diff and status output.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
   297
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   298
  $ hg init repo3
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   299
  $ cd repo3
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   300
  $ touch modified removed deleted ignored
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   301
  $ echo "^ignored$" > .hgignore
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   302
  $ hg commit -A -m 'initial checkin'
39091
ddc1da134772 addremove: add associated color for the new labels
Boris Feld <boris.feld@octobus.net>
parents: 38787
diff changeset
   303
  \x1b[0;32madding .hgignore\x1b[0m (esc)
ddc1da134772 addremove: add associated color for the new labels
Boris Feld <boris.feld@octobus.net>
parents: 38787
diff changeset
   304
  \x1b[0;32madding deleted\x1b[0m (esc)
ddc1da134772 addremove: add associated color for the new labels
Boris Feld <boris.feld@octobus.net>
parents: 38787
diff changeset
   305
  \x1b[0;32madding modified\x1b[0m (esc)
ddc1da134772 addremove: add associated color for the new labels
Boris Feld <boris.feld@octobus.net>
parents: 38787
diff changeset
   306
  \x1b[0;32madding removed\x1b[0m (esc)
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   307
  $ touch added unknown ignored
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   308
  $ hg add added
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   309
  $ echo "test" >> modified
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   310
  $ hg remove removed
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   311
  $ rm deleted
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   312
  $ hg copy modified copied
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   313
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   314
test unknown color
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   315
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
   316
  $ hg --config color.status.modified=periwinkle status
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   317
  ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
31105
45be7590301d color: move triggering of the initialisation logic in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30173
diff changeset
   318
  ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
31111
95ec3ad62f62 color: initialize color for the localrepo ui
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31110
diff changeset
   319
  ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   320
  M modified
17910
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   321
  \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   322
  \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   323
  \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   324
  \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
c8709ff57ff2 status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents: 16913
diff changeset
   325
  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
8945
7b3d837ca60e color: don't blow up if configured with unknown color (just warn).
Greg Ward <greg-hg@gerg.ca>
parents: 7458
diff changeset
   326
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12316
diff changeset
   327
Run status with 2 different flags.
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12316
diff changeset
   328
Check if result is the same or different.
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12316
diff changeset
   329
If result is not as expected, raise error
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12316
diff changeset
   330
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   331
  $ assert() {
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
   332
  >     hg status $1 > ../a
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
   333
  >     hg status $2 > ../b
12365
22f3353bcc36 tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12328
diff changeset
   334
  >     if diff ../a ../b > /dev/null; then
22f3353bcc36 tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12328
diff changeset
   335
  >         out=0
22f3353bcc36 tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12328
diff changeset
   336
  >     else
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   337
  >         out=1
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   338
  >     fi
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   339
  >     if [ $3 -eq 0 ]; then
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   340
  >         df="same"
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   341
  >     else
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   342
  >         df="different"
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   343
  >     fi
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   344
  >     if [ $out -ne $3 ]; then
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   345
  >         echo "Error on $1 and $2, should be $df."
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   346
  >     fi
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   347
  > }
7458
03dd55115985 color: Add tests for colorized diff and status output.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
   348
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12316
diff changeset
   349
assert flag1 flag2 [0-same | 1-different]
7458
03dd55115985 color: Add tests for colorized diff and status output.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
   350
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   351
  $ assert "-q" "-mard"      0
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   352
  $ assert "-A" "-marduicC"  0
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   353
  $ assert "-qA" "-mardcC"   0
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   354
  $ assert "-qAui" "-A"      0
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   355
  $ assert "-qAu" "-marducC" 0
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   356
  $ assert "-qAi" "-mardicC" 0
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   357
  $ assert "-qu" "-u"        0
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   358
  $ assert "-q" "-u"         1
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   359
  $ assert "-m" "-a"         1
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   360
  $ assert "-r" "-d"         1
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   361
  $ cd ..
10223
51421ab573de color: colorize output of hg resolve -l
Georg Brandl <georg@python.org>
parents: 8945
diff changeset
   362
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12316
diff changeset
   363
test 'resolve -l'
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12316
diff changeset
   364
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   365
  $ hg init repo4
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   366
  $ cd repo4
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   367
  $ echo "file a" > a
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   368
  $ echo "file b" > b
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   369
  $ hg add a b
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   370
  $ hg commit -m "initial"
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   371
  $ echo "file a change 1" > a
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   372
  $ echo "file b change 1" > b
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   373
  $ hg commit -m "head 1"
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   374
  $ hg update 0
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   375
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   376
  $ echo "file a change 2" > a
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   377
  $ echo "file b change 2" > b
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   378
  $ hg commit -m "head 2"
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   379
  created new head
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   380
  $ hg merge
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   381
  merging a
26618
8e6d5b7317e6 merge.mergestate: perform all premerges before any merges (BC)
Siddharth Agarwal <sid0@fb.com>
parents: 26614
diff changeset
   382
  merging b
26614
ef1eb6df7071 simplemerge: move conflict warning message to filemerge
Siddharth Agarwal <sid0@fb.com>
parents: 24127
diff changeset
   383
  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
ef1eb6df7071 simplemerge: move conflict warning message to filemerge
Siddharth Agarwal <sid0@fb.com>
parents: 24127
diff changeset
   384
  warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   385
  0 files updated, 0 files merged, 0 files removed, 2 files unresolved
35704
41ef02ba329b merge: add `--abort` flag which can abort the merge
Pulkit Goyal <7895pulkit@gmail.com>
parents: 35205
diff changeset
   386
  use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12314
diff changeset
   387
  [1]
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   388
  $ hg resolve -m b
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   389
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   390
hg resolve with one unresolved, one resolved:
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
   391
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
   392
  $ hg resolve -l
24127
4cb8002658d6 resolve: port to generic templater
Yuya Nishihara <yuya@tcha.org>
parents: 23172
diff changeset
   393
  \x1b[0;31;1mU \x1b[0m\x1b[0;31;1ma\x1b[0m (esc)
4cb8002658d6 resolve: port to generic templater
Yuya Nishihara <yuya@tcha.org>
parents: 23172
diff changeset
   394
  \x1b[0;32;1mR \x1b[0m\x1b[0;32;1mb\x1b[0m (esc)
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16350
diff changeset
   395
21227
75aaae8ad660 color: don't fail on error messages when no curses (issue4237)
Mads Kiilerich <madski@unity3d.com>
parents: 20387
diff changeset
   396
color coding of error message with current availability of curses
75aaae8ad660 color: don't fail on error messages when no curses (issue4237)
Mads Kiilerich <madski@unity3d.com>
parents: 20387
diff changeset
   397
75aaae8ad660 color: don't fail on error messages when no curses (issue4237)
Mads Kiilerich <madski@unity3d.com>
parents: 20387
diff changeset
   398
  $ hg unknowncommand > /dev/null
75aaae8ad660 color: don't fail on error messages when no curses (issue4237)
Mads Kiilerich <madski@unity3d.com>
parents: 20387
diff changeset
   399
  hg: unknown command 'unknowncommand'
38787
5199c5b6fd29 dispatch: don't show list of commands on bogus command
Martin von Zweigbergk <martinvonz@google.com>
parents: 35704
diff changeset
   400
  (use 'hg help' for a list of commands)
46262
9c9e0b4b2ca7 error: use detailed exit code 10 for command errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 40097
diff changeset
   401
  [10]
21227
75aaae8ad660 color: don't fail on error messages when no curses (issue4237)
Mads Kiilerich <madski@unity3d.com>
parents: 20387
diff changeset
   402
75aaae8ad660 color: don't fail on error messages when no curses (issue4237)
Mads Kiilerich <madski@unity3d.com>
parents: 20387
diff changeset
   403
color coding of error message without curses
75aaae8ad660 color: don't fail on error messages when no curses (issue4237)
Mads Kiilerich <madski@unity3d.com>
parents: 20387
diff changeset
   404
75aaae8ad660 color: don't fail on error messages when no curses (issue4237)
Mads Kiilerich <madski@unity3d.com>
parents: 20387
diff changeset
   405
  $ echo 'raise ImportError' > curses.py
75aaae8ad660 color: don't fail on error messages when no curses (issue4237)
Mads Kiilerich <madski@unity3d.com>
parents: 20387
diff changeset
   406
  $ PYTHONPATH=`pwd`:$PYTHONPATH hg unknowncommand > /dev/null
75aaae8ad660 color: don't fail on error messages when no curses (issue4237)
Mads Kiilerich <madski@unity3d.com>
parents: 20387
diff changeset
   407
  hg: unknown command 'unknowncommand'
38787
5199c5b6fd29 dispatch: don't show list of commands on bogus command
Martin von Zweigbergk <martinvonz@google.com>
parents: 35704
diff changeset
   408
  (use 'hg help' for a list of commands)
46262
9c9e0b4b2ca7 error: use detailed exit code 10 for command errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 40097
diff changeset
   409
  [10]
21227
75aaae8ad660 color: don't fail on error messages when no curses (issue4237)
Mads Kiilerich <madski@unity3d.com>
parents: 20387
diff changeset
   410
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16350
diff changeset
   411
  $ cd ..