##// END OF EJS Templates
color: don't crash on invalid status codes (issue2036)...
Brodie Rao -
r10475:2253715f default
parent child Browse files
Show More
@@ -117,10 +117,16 b' def _colorstatuslike(abbreviations, effe'
117
117
118 # apply color to output and display it
118 # apply color to output and display it
119 for i in xrange(len(lines)):
119 for i in xrange(len(lines)):
120 status = abbreviations[lines_with_status[i][0]]
120 try:
121 effects = effectdefs[status]
121 status = abbreviations[lines_with_status[i][0]]
122 if effects:
122 except KeyError:
123 lines[i] = render_effects(lines[i], effects)
123 # Ignore lines with invalid codes, especially in the case of
124 # of unknown filenames containing newlines (issue2036).
125 pass
126 else:
127 effects = effectdefs[status]
128 if effects:
129 lines[i] = render_effects(lines[i], effects)
124 ui.write(lines[i] + delimiter)
130 ui.write(lines[i] + delimiter)
125 return retval
131 return retval
126
132
@@ -3,6 +3,7 b''
3
3
4 "$TESTDIR/hghave" eol-in-paths || exit 80
4 "$TESTDIR/hghave" eol-in-paths || exit 80
5
5
6 echo % test issue352
6 hg init foo
7 hg init foo
7 cd foo
8 cd foo
8
9
@@ -21,4 +22,22 b' hg ci -A -m m'
21 echo foo > "$A"
22 echo foo > "$A"
22 hg debugwalk
23 hg debugwalk
23
24
25 # http://mercurial.selenic.com/bts/issue2036
26 cd ..
27 echo % test issue2039
28
29 hg init bar
30 cd bar
31
32 echo "[extensions]" >> $HGRCPATH
33 echo "color=" >> $HGRCPATH
34
35 A=`printf 'foo\nbar'`
36 B=`printf 'foo\nbar.baz'`
37
38 touch "$A"
39 touch "$B"
40
41 hg status --color=always
42
24 exit 0
43 exit 0
@@ -1,3 +1,4 b''
1 % test issue352
1 adding he llo
2 adding he llo
2 abort: '\n' and '\r' disallowed in filenames: 'he\rllo'
3 abort: '\n' and '\r' disallowed in filenames: 'he\rllo'
3 adding he llo
4 adding he llo
@@ -12,3 +13,8 b' f he\rllo he\rllo'
12 f hell
13 f hell
13 o hell
14 o hell
14 o
15 o
16 % test issue2039
17 ? foo
18 bar
19 ? foo
20 bar.baz
General Comments 0
You need to be logged in to leave comments. Login now