# HG changeset patch # User Martin Geisler # Date 2010-02-14 23:14:16 # Node ID 44b4a2a3162319ef6d21c9e9f191ecf2c42ea609 # Parent 3113736dbac569becf3ce1ac24998a655e9e40f8 # Parent 2253715fde970449d762b5a2cb22352e59df6d7d Merge with default diff --git a/hgext/color.py b/hgext/color.py --- a/hgext/color.py +++ b/hgext/color.py @@ -117,10 +117,16 @@ def _colorstatuslike(abbreviations, effe # apply color to output and display it for i in xrange(len(lines)): - status = abbreviations[lines_with_status[i][0]] - effects = effectdefs[status] - if effects: - lines[i] = render_effects(lines[i], effects) + try: + status = abbreviations[lines_with_status[i][0]] + except KeyError: + # Ignore lines with invalid codes, especially in the case of + # of unknown filenames containing newlines (issue2036). + pass + else: + effects = effectdefs[status] + if effects: + lines[i] = render_effects(lines[i], effects) ui.write(lines[i] + delimiter) return retval diff --git a/tests/test-issue352 b/tests/test-eolfilename rename from tests/test-issue352 rename to tests/test-eolfilename --- a/tests/test-issue352 +++ b/tests/test-eolfilename @@ -3,6 +3,7 @@ "$TESTDIR/hghave" eol-in-paths || exit 80 +echo % test issue352 hg init foo cd foo @@ -21,4 +22,22 @@ hg ci -A -m m echo foo > "$A" hg debugwalk +# http://mercurial.selenic.com/bts/issue2036 +cd .. +echo % test issue2039 + +hg init bar +cd bar + +echo "[extensions]" >> $HGRCPATH +echo "color=" >> $HGRCPATH + +A=`printf 'foo\nbar'` +B=`printf 'foo\nbar.baz'` + +touch "$A" +touch "$B" + +hg status --color=always + exit 0 diff --git a/tests/test-issue352.out b/tests/test-eolfilename.out rename from tests/test-issue352.out rename to tests/test-eolfilename.out --- a/tests/test-issue352.out +++ b/tests/test-eolfilename.out @@ -1,3 +1,4 @@ +% test issue352 adding he llo abort: '\n' and '\r' disallowed in filenames: 'he\rllo' adding he llo @@ -12,3 +13,8 @@ f he llo he llo f hell o hell o +% test issue2039 +? foo +bar +? foo +bar.baz