Mercurial > hg
annotate tests/test-mq-symlinks.t @ 21857:86c2d792a4b7
util: replace 'ellipsis' implementation by 'encoding.trim'
Before this patch, 'util.ellipsis' tried to avoid splitting at
intermediate multi-byte sequence, but its implementation was incorrect.
Internal function '_ellipsis' trims specified unicode sequence not at
most maxlength 'columns in display', but at most maxlength number of
'unicode characters'.
def _ellipsis(text, maxlength):
if len(text) <= maxlength:
return text, False
else:
return "%s..." % (text[:maxlength - 3]), True
In many encodings, number of unicode characters can be different from
columns in display.
This patch replaces 'ellipsis' implementation by 'encoding.trim',
which can trim string at most maxlength columns in display correctly,
even though specified string contains multi-byte characters.
'_ellipsis' is removed in this patch, because it is referred only from
'ellipsis'.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sun, 06 Jul 2014 02:56:41 +0900 |
parents | 904b7109938e |
children | 7a9cbb315d84 |
rev | line source |
---|---|
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
1 $ "$TESTDIR/hghave" symlink || exit 80 |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
2 |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
3 $ echo "[extensions]" >> $HGRCPATH |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
4 $ echo "mq=" >> $HGRCPATH |
5157
f6c520fd70cf
mq: teach qpop about symlinks
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
5 |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
6 $ hg init |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
7 $ hg qinit |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
8 $ hg qnew base.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
9 $ echo aaa > a |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
10 $ echo bbb > b |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
11 $ echo ccc > c |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
12 $ hg add a b c |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
13 $ hg qrefresh |
16350
4f795f5fbb0b
tests: make tests work if directory contains special characters
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14453
diff
changeset
|
14 $ "$TESTDIR/readlink.py" a |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
15 a -> a not a symlink |
6360
95413879bac9
test-mq-symlinks: skip if symlinks are not supported
Patrick Mezard <pmezard@gmail.com>
parents:
5683
diff
changeset
|
16 |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
17 |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
18 test replacing a file with a symlink |
5157
f6c520fd70cf
mq: teach qpop about symlinks
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
19 |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
20 $ hg qnew symlink.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
21 $ rm a |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
22 $ ln -s b a |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
23 $ hg qrefresh --git |
16350
4f795f5fbb0b
tests: make tests work if directory contains special characters
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14453
diff
changeset
|
24 $ "$TESTDIR/readlink.py" a |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
25 a -> b |
5157
f6c520fd70cf
mq: teach qpop about symlinks
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
26 |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
27 $ hg qpop |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
28 popping symlink.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
29 now at: base.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
30 $ hg qpush |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
31 applying symlink.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
32 now at: symlink.patch |
16350
4f795f5fbb0b
tests: make tests work if directory contains special characters
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14453
diff
changeset
|
33 $ "$TESTDIR/readlink.py" a |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
34 a -> b |
5157
f6c520fd70cf
mq: teach qpop about symlinks
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
35 |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
36 |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
37 test updating a symlink |
7517
49f34b43cf90
patch: handle git patches that remove symlinks (issue1438)
Brendan Cully <brendan@kublai.com>
parents:
6360
diff
changeset
|
38 |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
39 $ rm a |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
40 $ ln -s c a |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
41 $ hg qnew --git -f updatelink |
16350
4f795f5fbb0b
tests: make tests work if directory contains special characters
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14453
diff
changeset
|
42 $ "$TESTDIR/readlink.py" a |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
43 a -> c |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
44 $ hg qpop |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
45 popping updatelink |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
46 now at: symlink.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
47 $ hg qpush --debug |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
48 applying updatelink |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
49 patching file a |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
50 a |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
51 now at: updatelink |
16350
4f795f5fbb0b
tests: make tests work if directory contains special characters
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14453
diff
changeset
|
52 $ "$TESTDIR/readlink.py" a |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
53 a -> c |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
54 $ hg st |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
55 |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
56 |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
57 test replacing a symlink with a file |
9586
d08099e74b81
patch: handle symlink updates/replacements (issue1785)
Patrick Mezard <pmezard@gmail.com>
parents:
9585
diff
changeset
|
58 |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
59 $ ln -s c s |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
60 $ hg add s |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
61 $ hg qnew --git -f addlink |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
62 $ rm s |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
63 $ echo sss > s |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
64 $ hg qnew --git -f replacelinkwithfile |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
65 $ hg qpop |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
66 popping replacelinkwithfile |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
67 now at: addlink |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
68 $ hg qpush |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
69 applying replacelinkwithfile |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
70 now at: replacelinkwithfile |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
71 $ cat s |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
72 sss |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
73 $ hg st |
9586
d08099e74b81
patch: handle symlink updates/replacements (issue1785)
Patrick Mezard <pmezard@gmail.com>
parents:
9585
diff
changeset
|
74 |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
75 |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
76 test symlink removal |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
77 |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
78 $ hg qnew removesl.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
79 $ hg rm a |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
80 $ hg qrefresh --git |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
81 $ hg qpop |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
82 popping removesl.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
83 now at: replacelinkwithfile |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
84 $ hg qpush |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
85 applying removesl.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
86 now at: removesl.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
87 $ hg st -c |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
88 C b |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
89 C c |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
90 C s |
12345 | 91 |
92 replace broken symlink with another broken symlink | |
12340
b0bb72460c44
patch: fix target when patching broken symlinks (issue2368)
Patrick Mezard <pmezard@gmail.com>
parents:
10397
diff
changeset
|
93 |
12345 | 94 $ ln -s linka linka |
95 $ hg add linka | |
96 $ hg qnew link | |
97 $ hg mv linka linkb | |
12398 | 98 $ rm linkb |
99 $ ln -s linkb linkb | |
12345 | 100 $ hg qnew movelink |
101 $ hg qpop | |
102 popping movelink | |
103 now at: link | |
104 $ hg qpush | |
105 applying movelink | |
106 now at: movelink | |
16350
4f795f5fbb0b
tests: make tests work if directory contains special characters
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14453
diff
changeset
|
107 $ "$TESTDIR/readlink.py" linkb |
12345 | 108 linkb -> linkb |