##// END OF EJS Templates
test-win32text: use (esc) lines instead of Python script
Martin Geisler -
r12977:a1a50567 default
parent child Browse files
Show More
@@ -9,10 +9,6 b''
9 > data = data.replace('\n', '\r\n')
9 > data = data.replace('\n', '\r\n')
10 > file(path, 'wb').write(data)
10 > file(path, 'wb').write(data)
11 > EOF
11 > EOF
12 $ cat > print.py <<EOF
13 > import sys
14 > print(sys.stdin.read().replace('\n', '<LF>').replace('\r', '<CR>').replace('\0', '<NUL>'))
15 > EOF
16 $ echo '[hooks]' >> .hg/hgrc
12 $ echo '[hooks]' >> .hg/hgrc
17 $ echo 'pretxncommit.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc
13 $ echo 'pretxncommit.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc
18 $ echo 'pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc
14 $ echo 'pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc
@@ -369,12 +365,13 b' and now for something completely differe'
369 $ python -c 'file("f4.bat", "wb").write("rem empty\x0D\x0A")'
365 $ python -c 'file("f4.bat", "wb").write("rem empty\x0D\x0A")'
370 $ hg add f3 f4.bat
366 $ hg add f3 f4.bat
371 $ hg ci -m 6
367 $ hg ci -m 6
372 $ python print.py < bin
368 $ cat bin
373 hello<NUL><CR><LF>
369 hello\x00\r (esc)
374 $ python print.py < f3
370 $ cat f3
375 some<LF>text<LF>
371 some
376 $ python print.py < f4.bat
372 text
377 rem empty<CR><LF>
373 $ cat f4.bat
374 rem empty\r (esc)
378 $ echo
375 $ echo
379
376
380 $ echo '[extensions]' >> .hg/hgrc
377 $ echo '[extensions]' >> .hg/hgrc
@@ -411,32 +408,33 b' Disable warning:'
411 Before your next commit, please reconsider your encode/decode settings in
408 Before your next commit, please reconsider your encode/decode settings in
412 Mercurial.ini or ..../.hg/hgrc.
409 Mercurial.ini or ..../.hg/hgrc.
413 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
410 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
414 $ python print.py < bin
411 $ cat bin
415 hello<NUL><CR><LF>
412 hello\x00\r (esc)
416 $ python print.py < f3
413 $ cat f3
417 some<CR><LF>text<CR><LF>
414 some\r (esc)
418 $ python print.py < f4.bat
415 text\r (esc)
419 rem empty<CR><LF>
416 $ cat f4.bat
417 rem empty\r (esc)
420 $ echo
418 $ echo
421
419
422 $ python -c 'file("f5.sh", "wb").write("# empty\x0D\x0A")'
420 $ python -c 'file("f5.sh", "wb").write("# empty\x0D\x0A")'
423 $ hg add f5.sh
421 $ hg add f5.sh
424 $ hg ci -m 7
422 $ hg ci -m 7
425 $ python print.py < f5.sh
423 $ cat f5.sh
426 # empty<CR><LF>
424 # empty\r (esc)
427 $ hg cat f5.sh | python print.py
425 $ hg cat f5.sh
428 # empty<LF>
426 # empty
429 $ echo '% just linefeed' > linefeed
427 $ echo '% just linefeed' > linefeed
430 $ hg ci -qAm 8 linefeed
428 $ hg ci -qAm 8 linefeed
431 $ python print.py < linefeed
429 $ cat linefeed
432 % just linefeed<LF>
430 % just linefeed
433 $ hg cat linefeed | python print.py
431 $ hg cat linefeed
434 % just linefeed<LF>
432 % just linefeed
435 $ hg st -q
433 $ hg st -q
436 $ hg revert -a linefeed
434 $ hg revert -a linefeed
437 no changes needed to linefeed
435 no changes needed to linefeed
438 $ python print.py < linefeed
436 $ cat linefeed
439 % just linefeed<LF>
437 % just linefeed
440 $ hg st -q
438 $ hg st -q
441 $ echo modified >> linefeed
439 $ echo modified >> linefeed
442 $ hg st -q
440 $ hg st -q
@@ -444,5 +442,5 b' Disable warning:'
444 $ hg revert -a
442 $ hg revert -a
445 reverting linefeed
443 reverting linefeed
446 $ hg st -q
444 $ hg st -q
447 $ python print.py < linefeed
445 $ cat linefeed
448 % just linefeed<CR><LF>
446 % just linefeed\r (esc)
General Comments 0
You need to be logged in to leave comments. Login now