|
1 #!/bin/sh |
|
2 |
|
3 hgserve() |
|
4 { |
|
5 hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -E errors.log -v $@ \ |
|
6 | sed -e 's/:[0-9][0-9]*//g' -e 's/http:\/\/[^/]*\//http:\/\/localhost\//' |
|
7 cat hg.pid >> "$DAEMON_PIDS" |
|
8 } |
|
9 |
|
10 hg init a |
|
11 hg --encoding utf-8 -R a branch æ |
|
12 echo foo > a/foo |
|
13 hg -R a ci -Am foo |
|
14 |
|
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 hg --encoding utf-8 -R b log |
|
18 echo bar >> b/foo |
|
19 hg -R b ci -m bar |
|
20 hg --encoding utf-8 -R b push | sed "s/$HGPORT1/PORT/" |
|
21 hg -R a --encoding utf-8 log |
|
22 |
|
23 kill `cat hg.pid` |
|
24 |
|
25 |
|
26 # verify 7e7d56fe4833 (encoding fallback in branchmap to maintain compatibility with 1.3.x) |
|
27 |
|
28 cat <<EOF > oldhg |
|
29 import sys |
|
30 from mercurial import ui, hg, commands |
|
31 |
|
32 class StdoutWrapper(object): |
|
33 def __init__(self, stdout): |
|
34 self._file = stdout |
|
35 |
|
36 def write(self, data): |
|
37 if data == '47\n': |
|
38 # latin1 encoding is one %xx (3 bytes) shorter |
|
39 data = '44\n' |
|
40 elif data.startswith('%C3%A6 '): |
|
41 # translate to latin1 encoding |
|
42 data = '%%E6 %s' % data[7:] |
|
43 self._file.write(data) |
|
44 |
|
45 def __getattr__(self, name): |
|
46 return getattr(self._file, name) |
|
47 |
|
48 sys.stdout = StdoutWrapper(sys.stdout) |
|
49 sys.stderr = StdoutWrapper(sys.stderr) |
|
50 |
|
51 myui = ui.ui() |
|
52 repo = hg.repository(myui, 'a') |
|
53 commands.serve(myui, repo, stdio=True) |
|
54 EOF |
|
55 |
|
56 echo baz >> b/foo |
|
57 hg -R b ci -m baz |
|
58 hg push -R b -e 'python oldhg' ssh://dummy/ --encoding latin1 |