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