Mercurial > hg
annotate tests/test-merge-symlinks @ 12252:4481f8a93c7a stable
convert/darcs: handle non-ASCII metadata in darcs changelog (issue2354)
Given a commit author or message with non-ASCII characters in a darcs
repo, convert would raise a UnicodeEncodeError when adding changesets
to the hg changelog.
This happened because etree returns back unicode objects for any text
it can't encode into ASCII. convert was passing these objects to
changelog.add(), which would then attempt encoding.fromlocal() on
them.
This patch ensures converter_source.recode() is called on each piece
of commit data returned by etree.
(Also note that darcs is currently encoding agnostic and will print
out whatever is in a patch's metadata byte-for-byte, even in the XML
changelog.)
author | Brodie Rao <brodie@bitheap.org> |
---|---|
date | Fri, 10 Sep 2010 09:30:50 -0500 |
parents | a6477aa893b8 |
children |
rev | line source |
---|---|
5391
786c1206a029
Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
1 #!/bin/sh |
786c1206a029
Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
2 |
786c1206a029
Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
3 cat > echo.py <<EOF |
786c1206a029
Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
4 #!/usr/bin/env python |
7080
a6477aa893b8
tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents:
5408
diff
changeset
|
5 import os, sys |
a6477aa893b8
tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents:
5408
diff
changeset
|
6 try: |
a6477aa893b8
tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents:
5408
diff
changeset
|
7 import msvcrt |
a6477aa893b8
tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents:
5408
diff
changeset
|
8 msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) |
a6477aa893b8
tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents:
5408
diff
changeset
|
9 msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY) |
a6477aa893b8
tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents:
5408
diff
changeset
|
10 except ImportError: |
a6477aa893b8
tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents:
5408
diff
changeset
|
11 pass |
a6477aa893b8
tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents:
5408
diff
changeset
|
12 |
5408
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
13 for k in ('HG_FILE', 'HG_MY_ISLINK', 'HG_OTHER_ISLINK', 'HG_BASE_ISLINK'): |
5391
786c1206a029
Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
14 print k, os.environ[k] |
786c1206a029
Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
15 EOF |
786c1206a029
Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
16 |
786c1206a029
Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
17 # Create 2 heads containing the same file, once as |
5408
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
18 # a file, once as a link. Bundle was generated with: |
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
19 # |
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
20 # hg init t |
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
21 # cd t |
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
22 # echo a > a |
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
23 # hg ci -qAm t0 -d '0 0' |
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
24 # echo l > l |
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
25 # hg ci -qAm t1 -d '1 0' |
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
26 # hg up -C 0 |
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
27 # ln -s a l |
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
28 # hg ci -qAm t2 -d '2 0' |
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
29 # echo l2 > l2 |
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
30 # hg ci -qAm t3 -d '3 0' |
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
31 |
5391
786c1206a029
Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
32 hg init t |
786c1206a029
Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
33 cd t |
5408
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
34 hg -q pull "$TESTDIR/test-merge-symlinks.hg" |
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
35 hg up -C 3 |
5391
786c1206a029
Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
36 |
786c1206a029
Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
37 # Merge them and display *_ISLINK vars |
786c1206a029
Test *_ISLINK merge environment vars
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
38 echo % merge heads |
5408
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
39 HGMERGE="python ../echo.py" hg merge |
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
40 |
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
41 # Test working directory symlink bit calculation wrt copies, |
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
42 # especially on non-supporting systems. |
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
43 echo % merge working directory |
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
44 hg up -C 2 |
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
45 hg copy l l2 |
36794dbe66a3
Test workingctx exec/link bit for copies.
Patrick Mezard <pmezard@gmail.com>
parents:
5391
diff
changeset
|
46 HGMERGE="python ../echo.py" hg up 3 |