##// END OF EJS Templates
tests: unify test-http-branchmap
Matt Mackall -
r12447:f5f90d38 default
parent child Browse files
Show More
@@ -1,58 +1,92 b''
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
1
28 cat <<EOF > oldhg
2 $ hgserve() {
29 import sys
3 > hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -E errors.log -v $@
30 from mercurial import ui, hg, commands
4 > cat hg.pid >> "$DAEMON_PIDS"
31
5 > }
32 class StdoutWrapper(object):
6 $ hg init a
33 def __init__(self, stdout):
7 $ hg --encoding utf-8 -R a branch æ
34 self._file = stdout
8 marked working directory as branch æ
9 $ echo foo > a/foo
10 $ hg -R a ci -Am foo
11 adding foo
12 $ hgserve -R a --config web.push_ssl=False --config web.allow_push=* --encoding latin1
13 listening at http://localhost*/ (bound to 127.0.0.1:*) (glob)
14 $ hg --encoding utf-8 clone http://localhost:$HGPORT1 b
15 requesting all changes
16 adding changesets
17 adding manifests
18 adding file changes
19 added 1 changesets with 1 changes to 1 files
20 updating to branch æ
21 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
22 $ hg --encoding utf-8 -R b log
23 changeset: 0:867c11ce77b8
24 branch: æ
25 tag: tip
26 user: test
27 date: Thu Jan 01 00:00:00 1970 +0000
28 summary: foo
29
30 $ echo bar >> b/foo
31 $ hg -R b ci -m bar
32 $ hg --encoding utf-8 -R b push
33 pushing to http://localhost:* (glob)
34 searching for changes
35 remote: adding changesets
36 remote: adding manifests
37 remote: adding file changes
38 remote: added 1 changesets with 1 changes to 1 files
39 $ hg -R a --encoding utf-8 log
40 changeset: 1:58e7c90d67cb
41 branch: æ
42 tag: tip
43 user: test
44 date: Thu Jan 01 00:00:00 1970 +0000
45 summary: bar
46
47 changeset: 0:867c11ce77b8
48 branch: æ
49 user: test
50 date: Thu Jan 01 00:00:00 1970 +0000
51 summary: foo
52
53 $ kill `cat hg.pid`
35
54
36 def write(self, data):
55 verify 7e7d56fe4833 (encoding fallback in branchmap to maintain compatibility with 1.3.x)
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
56
48 sys.stdout = StdoutWrapper(sys.stdout)
57 $ cat <<EOF > oldhg
49 sys.stderr = StdoutWrapper(sys.stderr)
58 > import sys
50
59 > from mercurial import ui, hg, commands
51 myui = ui.ui()
60 >
52 repo = hg.repository(myui, 'a')
61 > class StdoutWrapper(object):
53 commands.serve(myui, repo, stdio=True)
62 > def __init__(self, stdout):
54 EOF
63 > self._file = stdout
55
64 >
56 echo baz >> b/foo
65 > def write(self, data):
57 hg -R b ci -m baz
66 > if data == '47\n':
58 hg push -R b -e 'python oldhg' ssh://dummy/ --encoding latin1
67 > # latin1 encoding is one %xx (3 bytes) shorter
68 > data = '44\n'
69 > elif data.startswith('%C3%A6 '):
70 > # translate to latin1 encoding
71 > data = '%%E6 %s' % data[7:]
72 > self._file.write(data)
73 >
74 > def __getattr__(self, name):
75 > return getattr(self._file, name)
76 >
77 > sys.stdout = StdoutWrapper(sys.stdout)
78 > sys.stderr = StdoutWrapper(sys.stderr)
79 >
80 > myui = ui.ui()
81 > repo = hg.repository(myui, 'a')
82 > commands.serve(myui, repo, stdio=True)
83 > EOF
84 $ echo baz >> b/foo
85 $ hg -R b ci -m baz
86 $ hg push -R b -e 'python oldhg' ssh://dummy/ --encoding latin1
87 pushing to ssh://dummy/
88 searching for changes
89 remote: adding changesets
90 remote: adding manifests
91 remote: adding file changes
92 remote: added 1 changesets with 1 changes to 1 files
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now