Debian Codegraph @

tests/test-http-branchmap.t

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