##// END OF EJS Templates
test-http-branchmap: fix encoding test to wrap the server stream...
Yuya Nishihara -
r38050:69779a22 default
parent child Browse files
Show More
@@ -1,95 +1,94 b''
1 1 $ hgserve() {
2 2 > hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid \
3 3 > -E errors.log -v $@ > startup.log
4 4 > # Grepping hg serve stdout would hang on Windows
5 5 > grep -v 'listening at' startup.log
6 6 > cat hg.pid >> "$DAEMON_PIDS"
7 7 > }
8 8 $ hg init a
9 9 $ hg --encoding utf-8 -R a branch Γ¦
10 10 marked working directory as branch \xc3\xa6 (esc)
11 11 (branches are permanent and global, did you want a bookmark?)
12 12 $ echo foo > a/foo
13 13 $ hg -R a ci -Am foo
14 14 adding foo
15 15 $ hgserve -R a --config web.push_ssl=False --config web.allow_push=* --encoding latin1
16 16 $ hg --encoding utf-8 clone http://localhost:$HGPORT1 b
17 17 requesting all changes
18 18 adding changesets
19 19 adding manifests
20 20 adding file changes
21 21 added 1 changesets with 1 changes to 1 files
22 22 new changesets 867c11ce77b8
23 23 updating to branch \xc3\xa6 (esc)
24 24 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
25 25 $ hg --encoding utf-8 -R b log
26 26 changeset: 0:867c11ce77b8
27 27 branch: \xc3\xa6 (esc)
28 28 tag: tip
29 29 user: test
30 30 date: Thu Jan 01 00:00:00 1970 +0000
31 31 summary: foo
32 32
33 33 $ echo bar >> b/foo
34 34 $ hg -R b ci -m bar
35 35 $ hg --encoding utf-8 -R b push
36 36 pushing to http://localhost:$HGPORT1/
37 37 searching for changes
38 38 remote: adding changesets
39 39 remote: adding manifests
40 40 remote: adding file changes
41 41 remote: added 1 changesets with 1 changes to 1 files
42 42 $ hg -R a --encoding utf-8 log
43 43 changeset: 1:58e7c90d67cb
44 44 branch: \xc3\xa6 (esc)
45 45 tag: tip
46 46 user: test
47 47 date: Thu Jan 01 00:00:00 1970 +0000
48 48 summary: bar
49 49
50 50 changeset: 0:867c11ce77b8
51 51 branch: \xc3\xa6 (esc)
52 52 user: test
53 53 date: Thu Jan 01 00:00:00 1970 +0000
54 54 summary: foo
55 55
56 56 $ killdaemons.py hg.pid
57 57
58 58 verify 7e7d56fe4833 (encoding fallback in branchmap to maintain compatibility with 1.3.x)
59 59
60 60 $ cat <<EOF > oldhg
61 > import sys
62 > from mercurial import ui, hg, commands
61 > import threading
62 > from mercurial import hg, ui, wireprotoserver
63 63 >
64 64 > class StdoutWrapper(object):
65 65 > def __init__(self, stdout):
66 66 > self._file = stdout
67 67 >
68 68 > def write(self, data):
69 69 > if data == b'47\n':
70 70 > # latin1 encoding is one %xx (3 bytes) shorter
71 71 > data = b'44\n'
72 72 > elif data.startswith(b'%C3%A6 '):
73 73 > # translate to latin1 encoding
74 74 > data = b'%%E6 %s' % data[7:]
75 75 > self._file.write(data)
76 76 >
77 77 > def __getattr__(self, name):
78 78 > return getattr(self._file, name)
79 79 >
80 > sys.stdout = StdoutWrapper(getattr(sys.stdout, 'buffer', sys.stdout))
81 > sys.stderr = StdoutWrapper(getattr(sys.stderr, 'buffer', sys.stderr))
82 >
83 80 > myui = ui.ui.load()
81 > fout = StdoutWrapper(myui.fout)
82 > myui.fout = myui.ferr
84 83 > repo = hg.repository(myui, b'a')
85 > commands.serve(myui, repo, stdio=True, cmdserver=False)
84 > wireprotoserver._runsshserver(myui, repo, myui.fin, fout, threading.Event())
86 85 > EOF
87 86 $ echo baz >> b/foo
88 87 $ hg -R b ci -m baz
89 88 $ hg push -R b -e "\"$PYTHON\" oldhg" ssh://dummy/ --encoding latin1
90 89 pushing to ssh://dummy/
91 90 searching for changes
92 91 remote: adding changesets
93 92 remote: adding manifests
94 93 remote: adding file changes
95 94 remote: added 1 changesets with 1 changes to 1 files
General Comments 0
You need to be logged in to leave comments. Login now