annotate tests/test-status-color.t @ 14007:d764463b433e

atomictempfile: avoid infinite recursion in __del__(). The problem is that a programmer using atomictempfile directly can make an innocent everyday mistake -- not enough args to the constructor -- which escalates badly. You would expect a simple TypeError crash in that case, but you actually get an infinite recursion that is surprisingly difficult to kill: it happens between __del__() and __getattr__(), and Python does not handle infinite recursion from __del__() well. The fix is to not implement __getattr__(), but instead assign instance attributes for the methods we wish to delegate to the builtin file type: write() and fileno(). I've audited mercurial.* and hgext.* and found no users of atomictempfile using methods other than write() and rename(). I audited third-party extensions and found one (snap) passing an atomictempfile to util.fstat(), so I also threw in fileno(). The last time I submitted a similar patch, Matt proposed that we make atomictempfile a subclass of file instead of wrapping it. Rejected on grounds of unnecessary complexity: for one thing, it would make the Windows implementation of posixfile quite a bit more complex. It would have to become a subclass of file rather than a simple function -- but since it's written in C, this is non-obvious and non-trivial. Furthermore, there's nothing wrong with wrapping objects and delegating methods: it's a well-established pattern that works just fine in many cases. Subclassing is not the answer to all of life's problems.
author Greg Ward <greg@gerg.ca>
date Sun, 24 Apr 2011 19:25:10 -0400
parents b083d00578bf
children f0b047a24c57
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
1 $ echo "[extensions]" >> $HGRCPATH
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
2 $ echo "color=" >> $HGRCPATH
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
3 $ echo "[color]" >> $HGRCPATH
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
4 $ echo "mode=ansi" >> $HGRCPATH
13997
b083d00578bf test-status-color: fix terminfo code compatibility problem
Patrick Mezard <pmezard@gmail.com>
parents: 13987
diff changeset
5 Terminfo codes compatibility fix
b083d00578bf test-status-color: fix terminfo code compatibility problem
Patrick Mezard <pmezard@gmail.com>
parents: 13987
diff changeset
6 $ echo "color.none=0" >> $HGRCPATH
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
7
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
8 $ hg init repo1
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
9 $ cd repo1
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
10 $ 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
11 $ 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
12
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
13 hg status in repo root:
7458
03dd55115985 color: Add tests for colorized diff and status output.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
14
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
15 $ hg status --color=always
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
16 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
17 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
18 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
19 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
20 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
21 \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
22
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
23 hg status . in repo root:
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
24
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
25 $ hg status --color=always .
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
26 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
27 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
28 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
29 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
30 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
31 \x1b[0;35;1;4m? in_root\x1b[0m (esc)
7458
03dd55115985 color: Add tests for colorized diff and status output.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
32
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
33 $ hg status --color=always --cwd a
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
34 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
35 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
36 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
37 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
38 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
39 \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
40 $ hg status --color=always --cwd a .
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
41 \x1b[0;35;1;4m? 1/in_a_1\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
42 \x1b[0;35;1;4m? in_a\x1b[0m (esc)
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
43 $ hg status --color=always --cwd a ..
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
44 \x1b[0;35;1;4m? 1/in_a_1\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
45 \x1b[0;35;1;4m? in_a\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
46 \x1b[0;35;1;4m? ../b/1/in_b_1\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
47 \x1b[0;35;1;4m? ../b/2/in_b_2\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
48 \x1b[0;35;1;4m? ../b/in_b\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
49 \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
50
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
51 $ hg status --color=always --cwd b
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
52 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
53 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
54 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
55 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
56 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
57 \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
58 $ hg status --color=always --cwd b .
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
59 \x1b[0;35;1;4m? 1/in_b_1\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
60 \x1b[0;35;1;4m? 2/in_b_2\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
61 \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
62 $ hg status --color=always --cwd b ..
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
63 \x1b[0;35;1;4m? ../a/1/in_a_1\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
64 \x1b[0;35;1;4m? ../a/in_a\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
65 \x1b[0;35;1;4m? 1/in_b_1\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
66 \x1b[0;35;1;4m? 2/in_b_2\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
67 \x1b[0;35;1;4m? in_b\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
68 \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
69
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
70 $ hg status --color=always --cwd a/1
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
71 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
72 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
73 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
74 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
75 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
76 \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
77 $ hg status --color=always --cwd a/1 .
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
78 \x1b[0;35;1;4m? in_a_1\x1b[0m (esc)
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
79 $ hg status --color=always --cwd a/1 ..
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
80 \x1b[0;35;1;4m? in_a_1\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
81 \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
82
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
83 $ hg status --color=always --cwd b/1
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
84 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
85 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
86 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
87 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
88 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
89 \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
90 $ hg status --color=always --cwd b/1 .
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
91 \x1b[0;35;1;4m? in_b_1\x1b[0m (esc)
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
92 $ hg status --color=always --cwd b/1 ..
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
93 \x1b[0;35;1;4m? in_b_1\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
94 \x1b[0;35;1;4m? ../2/in_b_2\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
95 \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
96
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
97 $ hg status --color=always --cwd b/2
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
98 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
99 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
100 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
101 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
102 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
103 \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
104 $ hg status --color=always --cwd b/2 .
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
105 \x1b[0;35;1;4m? in_b_2\x1b[0m (esc)
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
106 $ hg status --color=always --cwd b/2 ..
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
107 \x1b[0;35;1;4m? ../1/in_b_1\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
108 \x1b[0;35;1;4m? in_b_2\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
109 \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
110 $ cd ..
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
111
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
112 $ hg init repo2
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
113 $ cd repo2
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
114 $ touch modified removed deleted ignored
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
115 $ echo "^ignored$" > .hgignore
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11783
diff changeset
116 $ hg ci -A -m 'initial checkin'
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
117 adding .hgignore
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
118 adding deleted
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
119 adding modified
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
120 adding removed
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
121 $ touch modified added unknown ignored
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
122 $ hg add added
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
123 $ hg remove removed
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
124 $ rm deleted
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
125
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
126 hg status:
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
127
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
128 $ hg status --color=always
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
129 \x1b[0;32;1mA added\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
130 \x1b[0;31;1mR removed\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
131 \x1b[0;36;1;4m! deleted\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
132 \x1b[0;35;1;4m? unknown\x1b[0m (esc)
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
133
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
134 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
135
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
136 $ hg status --color=always modified added removed deleted unknown never-existed ignored
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
137 never-existed: No such file or directory
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
138 \x1b[0;32;1mA added\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
139 \x1b[0;31;1mR removed\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
140 \x1b[0;36;1;4m! deleted\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
141 \x1b[0;35;1;4m? unknown\x1b[0m (esc)
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
142
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
143 $ hg copy modified copied
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
144
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
145 hg status -C:
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
146
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
147 $ hg status --color=always -C
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
148 \x1b[0;32;1mA added\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
149 \x1b[0;32;1mA copied\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
150 \x1b[0;0m modified\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
151 \x1b[0;31;1mR removed\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
152 \x1b[0;36;1;4m! deleted\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
153 \x1b[0;35;1;4m? unknown\x1b[0m (esc)
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
154
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
155 hg status -A:
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
156
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
157 $ hg status --color=always -A
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
158 \x1b[0;32;1mA added\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
159 \x1b[0;32;1mA copied\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
160 \x1b[0;0m modified\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
161 \x1b[0;31;1mR removed\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
162 \x1b[0;36;1;4m! deleted\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
163 \x1b[0;35;1;4m? unknown\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
164 \x1b[0;30;1mI ignored\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
165 \x1b[0;0mC .hgignore\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
166 \x1b[0;0mC modified\x1b[0m (esc)
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
167
13987
e0f07847f8de color: add support for terminfo-based attributes and color
Danek Duvall <duvall@comfychair.org>
parents: 12942
diff changeset
168 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
169
e0f07847f8de color: add support for terminfo-based attributes and color
Danek Duvall <duvall@comfychair.org>
parents: 12942
diff changeset
170 $ TERM=xterm hg status --config color.mode=terminfo --color=always -A
13997
b083d00578bf test-status-color: fix terminfo code compatibility problem
Patrick Mezard <pmezard@gmail.com>
parents: 13987
diff changeset
171 \x1b[30m\x1b[32m\x1b[1mA added\x1b[30m (esc)
b083d00578bf test-status-color: fix terminfo code compatibility problem
Patrick Mezard <pmezard@gmail.com>
parents: 13987
diff changeset
172 \x1b[30m\x1b[32m\x1b[1mA copied\x1b[30m (esc)
b083d00578bf test-status-color: fix terminfo code compatibility problem
Patrick Mezard <pmezard@gmail.com>
parents: 13987
diff changeset
173 \x1b[30m\x1b[30m modified\x1b[30m (esc)
b083d00578bf test-status-color: fix terminfo code compatibility problem
Patrick Mezard <pmezard@gmail.com>
parents: 13987
diff changeset
174 \x1b[30m\x1b[31m\x1b[1mR removed\x1b[30m (esc)
b083d00578bf test-status-color: fix terminfo code compatibility problem
Patrick Mezard <pmezard@gmail.com>
parents: 13987
diff changeset
175 \x1b[30m\x1b[36m\x1b[1m\x1b[4m! deleted\x1b[30m (esc)
b083d00578bf test-status-color: fix terminfo code compatibility problem
Patrick Mezard <pmezard@gmail.com>
parents: 13987
diff changeset
176 \x1b[30m\x1b[35m\x1b[1m\x1b[4m? unknown\x1b[30m (esc)
b083d00578bf test-status-color: fix terminfo code compatibility problem
Patrick Mezard <pmezard@gmail.com>
parents: 13987
diff changeset
177 \x1b[30m\x1b[30m\x1b[1mI ignored\x1b[30m (esc)
b083d00578bf test-status-color: fix terminfo code compatibility problem
Patrick Mezard <pmezard@gmail.com>
parents: 13987
diff changeset
178 \x1b[30m\x1b[30mC .hgignore\x1b[30m (esc)
b083d00578bf test-status-color: fix terminfo code compatibility problem
Patrick Mezard <pmezard@gmail.com>
parents: 13987
diff changeset
179 \x1b[30m\x1b[30mC modified\x1b[30m (esc)
13987
e0f07847f8de color: add support for terminfo-based attributes and color
Danek Duvall <duvall@comfychair.org>
parents: 12942
diff changeset
180
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
181
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
182 $ echo "^ignoreddir$" > .hgignore
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
183 $ mkdir ignoreddir
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
184 $ touch ignoreddir/file
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
185
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
186 hg status ignoreddir/file:
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
187
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
188 $ hg status --color=always ignoreddir/file
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
189
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
190 hg status -i ignoreddir/file:
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
191
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
192 $ hg status --color=always -i ignoreddir/file
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
193 \x1b[0;30;1mI ignoreddir/file\x1b[0m (esc)
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
194 $ cd ..
7458
03dd55115985 color: Add tests for colorized diff and status output.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
195
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12316
diff changeset
196 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
197
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
198 $ hg init repo3
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
199 $ cd repo3
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
200 $ touch modified removed deleted ignored
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
201 $ echo "^ignored$" > .hgignore
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
202 $ hg commit -A -m 'initial checkin'
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
203 adding .hgignore
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
204 adding deleted
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
205 adding modified
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
206 adding removed
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
207 $ touch added unknown ignored
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
208 $ hg add added
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
209 $ echo "test" >> modified
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
210 $ hg remove removed
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
211 $ rm deleted
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
212 $ hg copy modified copied
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
213
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
214 test unknown color
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
215
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
216 $ hg --config color.status.modified=periwinkle status --color=always
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
217 ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
218 M modified
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
219 \x1b[0;32;1mA added\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
220 \x1b[0;32;1mA copied\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
221 \x1b[0;31;1mR removed\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
222 \x1b[0;36;1;4m! deleted\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
223 \x1b[0;35;1;4m? unknown\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
224
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12316
diff changeset
225 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
226 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
227 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
228
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
229 $ assert() {
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
230 > hg status --color=always $1 > ../a
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
231 > hg status --color=always $2 > ../b
12365
22f3353bcc36 tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12328
diff changeset
232 > 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
233 > out=0
22f3353bcc36 tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12328
diff changeset
234 > else
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
235 > out=1
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
236 > fi
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
237 > if [ $3 -eq 0 ]; then
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
238 > df="same"
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
239 > else
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
240 > df="different"
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
241 > fi
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
242 > if [ $out -ne $3 ]; then
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
243 > 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
244 > fi
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
245 > }
7458
03dd55115985 color: Add tests for colorized diff and status output.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
246
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12316
diff changeset
247 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
248
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
249 $ assert "-q" "-mard" 0
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
250 $ assert "-A" "-marduicC" 0
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
251 $ assert "-qA" "-mardcC" 0
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
252 $ assert "-qAui" "-A" 0
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
253 $ assert "-qAu" "-marducC" 0
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
254 $ assert "-qAi" "-mardicC" 0
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
255 $ assert "-qu" "-u" 0
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
256 $ assert "-q" "-u" 1
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
257 $ assert "-m" "-a" 1
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
258 $ assert "-r" "-d" 1
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
259 $ cd ..
10223
51421ab573de color: colorize output of hg resolve -l
Georg Brandl <georg@python.org>
parents: 8945
diff changeset
260
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12316
diff changeset
261 test 'resolve -l'
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12316
diff changeset
262
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
263 $ hg init repo4
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
264 $ cd repo4
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
265 $ echo "file a" > a
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
266 $ echo "file b" > b
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
267 $ hg add a b
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
268 $ hg commit -m "initial"
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
269 $ echo "file a change 1" > a
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
270 $ echo "file b change 1" > b
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
271 $ hg commit -m "head 1"
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
272 $ hg update 0
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
273 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
274 $ echo "file a change 2" > a
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
275 $ echo "file b change 2" > b
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
276 $ hg commit -m "head 2"
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
277 created new head
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
278 $ hg merge
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
279 merging a
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
280 warning: conflicts during merge.
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
281 merging a failed!
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
282 merging b
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
283 warning: conflicts during merge.
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
284 merging b failed!
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
285 0 files updated, 0 files merged, 0 files removed, 2 files unresolved
12314
f2daa6ab514a merge: suggest 'hg up -C .' for discarding changes, not 'hg up -C'
Brodie Rao <brodie@bitheap.org>
parents: 12156
diff changeset
286 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12314
diff changeset
287 [1]
11783
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
288 $ hg resolve -m b
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 resolve with one unresolved, one resolved:
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
291
599a78030fa8 tests: unify test-status-color
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
292 $ hg resolve --color=always -l
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
293 \x1b[0;31;1mU a\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12365
diff changeset
294 \x1b[0;32;1mR b\x1b[0m (esc)