Mercurial > hg-stable
changeset 10477:44b4a2a31623 stable
Merge with default
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Mon, 15 Feb 2010 00:14:16 +0100 |
parents | 3113736dbac5 (current diff) 2253715fde97 (diff) |
children | ed4de30e16c5 bb508b312359 |
files | hgext/color.py tests/test-issue352 tests/test-issue352.out |
diffstat | 5 files changed, 73 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/color.py Mon Feb 15 00:12:10 2010 +0100 +++ b/hgext/color.py Mon Feb 15 00:14:16 2010 +0100 @@ -117,10 +117,16 @@ # 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-eolfilename Mon Feb 15 00:14:16 2010 +0100 @@ -0,0 +1,43 @@ +#!/bin/sh +# http://mercurial.selenic.com/bts/issue352 + +"$TESTDIR/hghave" eol-in-paths || exit 80 + +echo % test issue352 +hg init foo +cd foo + +A=`printf 'he\rllo'` + +echo foo > "$A" +hg add +hg ci -A -m m +rm "$A" + +echo foo > "hell +o" +hg add +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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-eolfilename.out Mon Feb 15 00:14:16 2010 +0100 @@ -0,0 +1,20 @@ +% test issue352 +adding he llo +abort: '\n' and '\r' disallowed in filenames: 'he\rllo' +adding he llo +abort: '\n' and '\r' disallowed in filenames: 'he\rllo' +adding hell +o +abort: '\n' and '\r' disallowed in filenames: 'hell\no' +adding hell +o +abort: '\n' and '\r' disallowed in filenames: 'hell\no' +f he llo he llo +f hell +o hell +o +% test issue2039 +[0;35;1;4m? foo[0m +bar +[0;35;1;4m? foo[0m +bar.baz
--- a/tests/test-issue352 Mon Feb 15 00:12:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -#!/bin/sh -# http://mercurial.selenic.com/bts/issue352 - -"$TESTDIR/hghave" eol-in-paths || exit 80 - -hg init foo -cd foo - -A=`printf 'he\rllo'` - -echo foo > "$A" -hg add -hg ci -A -m m -rm "$A" - -echo foo > "hell -o" -hg add -hg ci -A -m m - -echo foo > "$A" -hg debugwalk - -exit 0
--- a/tests/test-issue352.out Mon Feb 15 00:12:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -adding he llo -abort: '\n' and '\r' disallowed in filenames: 'he\rllo' -adding he llo -abort: '\n' and '\r' disallowed in filenames: 'he\rllo' -adding hell -o -abort: '\n' and '\r' disallowed in filenames: 'hell\no' -adding hell -o -abort: '\n' and '\r' disallowed in filenames: 'hell\no' -f he llo he llo -f hell -o hell -o