view tests/test-bisect2 @ 11297:d320e70442a5

replace Python standard textwrap by MBCS sensitive one for i18n text Mercurial has problem around text wrapping/filling in MBCS encoding environment, because standard 'textwrap' module of Python can not treat it correctly. It splits byte sequence for one character into two lines. According to unicode specification, "east asian width" classifies characters into: W(ide), N(arrow), F(ull-width), H(alf-width), A(mbiguous) W/N/F/H can be always recognized as 2/1/2/1 bytes in byte sequence, but 'A' can not. Size of 'A' depends on language in which it is used. Unicode specification says: If the context(= language) cannot be established reliably they should be treated as narrow characters by default but many of class 'A' characters are full-width, at least, in Japanese environment. So, this patch treats class 'A' characters as full-width always for safety wrapping. This patch focuses only on MBCS safe-ness, not on writing/printing rule strict wrapping for each languages MBCS sensitive textwrap class is originally implemented by ITO Nobuaki <daydream.trippers@gmail.com>.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sun, 06 Jun 2010 17:20:10 +0900
parents 9369095779a1
children
line wrap: on
line source

#!/bin/sh

# The tests in test-bisect are done on a linear history.
# Here the following repository history is used for testing:
#
#                     17
#                      |
#               18    16 
#                 \  /
#                  15
#                 /  \
#                /    \
#              10     13
#              / \     |
#             /   \    |  14
#        7   6     9  12 /
#         \ / \    |   |/
#          4   \   |  11
#           \   \  |  /
#            3   5 | /
#             \ /  |/ 
#              2   8
#               \ /
#                1
#                |
#                0

set -e

echo % init
hg init

echo % committing changes
echo > a
echo '0' >> a
hg add a
hg ci -m "0" -d "0 0"
echo '1' >> a
hg ci -m "1" -d "1 0"
echo '2' >> a
hg ci -m "2" -d "2 0"
echo '3' >> a
hg ci -m "3" -d "3 0"
echo '4' >> a
hg ci -m "4" -d "4 0"
# create branch
hg up -r 2
echo '5' >> b
hg add b
hg ci -m "5" -d "5 0"

# merge
hg merge
hg ci -m "merge 4,5" -d "6 0"

# create branch
hg up -r 4
echo '7' > c
hg add c
hg ci -m "7" -d "7 0"

# create branch
hg up -r 1
echo '8' > d
hg add d
hg ci -m "8" -d "8 0"
echo '9' >> d
hg ci -m "9" -d "9 0"

# merge
hg merge -r 6
hg ci -m "merge 6,9" -d "10 0"

# create branch
hg up -r 8
echo '11' > e
hg add e
hg ci -m "11" -d "11 0"
echo '12' >> e
hg ci -m "12" -d "12 0"
echo '13' >> e
hg ci -m "13" -d "13 0"

# create branch
hg up -r 11
echo '14' > f
hg add f
hg ci -m "14" -d "14 0"

# merge
hg up -r 13 -C
hg merge -r 10
hg ci -m "merge 10,13" -d "15 0"
echo '16' >> e
hg ci -m "16" -d "16 0"
echo '17' >> e
hg ci -m "17" -d "17 0"

# create branch
hg up -r 15
echo '18' >> e
hg ci -m "18" -d "18 0"


echo % log
hg log

echo % hg up -C
hg up -C

echo % complex bisect test 1  # first bad rev is 9
hg bisect -r
hg bisect -g 0
hg bisect -b 17   # -> update to rev 6
hg bisect -g      # -> update to rev 13
hg bisect -s      # -> update to rev 10
hg bisect -b      # -> update to rev 8
hg bisect -g      # -> update to rev 9
hg bisect -b

echo % complex bisect test 2  # first good rev is 13
hg bisect -r
hg bisect -g 18
hg bisect -b 1    # -> update to rev 6
hg bisect -s      # -> update to rev 10
hg bisect -b      # -> update to rev 12
hg bisect -b      # -> update to rev 13
hg bisect -g

echo % complex bisect test 3  
# first bad rev is 15 
# 10,9,13 are skipped an might be the first bad revisions as well
hg bisect -r
hg bisect -g 1
hg bisect -b 16   # -> update to rev 6
hg bisect -g      # -> update to rev 13
hg bisect -s      # -> update to rev 10
hg bisect -s      # -> update to rev 12
hg bisect -g      # -> update to rev 9
hg bisect -s      # -> update to rev 15
hg bisect -b

echo % complex bisect test 4
# first good revision is 17
# 15,16 are skipped an might be the first good revisions as well
hg bisect -r
hg bisect -g 17
hg bisect -b 8    # -> update to rev 10
hg bisect -b      # -> update to rev 13
hg bisect -b      # -> update to rev 15
hg bisect -s      # -> update to rev 16
hg bisect -s