Mercurial > hg
annotate tests/test-patch @ 12717:89df79b3c011 stable
convert/darcs: support changelogs with bytes 0x7F-0xFF (issue2411)
This is a followup to 4481f8a93c7a, which only fixed the conversion of
patches with UTF-8 metadata.
This patch allows a changelog to have any bytes with values
0x7F-0xFF. It parses the XML changelog as Latin-1 and uses
converter_source.recode() to decode the data as UTF-8/Latin-1.
Caveats:
- Since the convert extension doesn't provide any way to specify the
source encoding, users are still limited to UTF-8 and Latin-1.
- etree will still complain if the changelog has bytes with values
0x00-0x19. XML only allows printable characters.
author | Brodie Rao <brodie@bitheap.org> |
---|---|
date | Fri, 01 Oct 2010 10:15:04 -0500 |
parents | 0de7e6e27fe4 |
children |
rev | line source |
---|---|
4645
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
1 #!/bin/sh |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
2 |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
3 cat > patchtool.py <<EOF |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
4 import sys |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
5 print 'Using custom patch' |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
6 if '--binary' in sys.argv: |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
7 print '--binary found !' |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
8 EOF |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
9 |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
10 echo "[ui]" >> $HGRCPATH |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
11 echo "patch=python ../patchtool.py" >> $HGRCPATH |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
12 |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
13 hg init a |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
14 cd a |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
15 echo a > a |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
16 hg commit -Ama -d '1 0' |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
17 echo b >> a |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
18 hg commit -Amb -d '2 0' |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
19 cd .. |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
20 |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
21 # This test check that: |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
22 # - custom patch commands with arguments actually works |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
23 # - patch code does not try to add weird arguments like |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
24 # --binary when custom patch commands are used. For instance |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
25 # --binary is added by default under win32. |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
26 |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
27 echo % check custom patch options are honored |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
28 hg --cwd a export -o ../a.diff tip |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
29 hg clone -r 0 a b |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
30 |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
31 hg --cwd b import -v ../a.diff |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
32 |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
33 |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
34 |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
35 |
0de7e6e27fe4
Add tests for ui.patch regression.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
36 |