Show More
@@ -1,120 +1,121 b'' | |||||
1 | #testcases sshv1 sshv2 |
|
1 | #testcases sshv1 sshv2 | |
2 |
|
2 | |||
3 | #if sshv2 |
|
3 | #if sshv2 | |
4 | $ cat >> $HGRCPATH << EOF |
|
4 | $ cat >> $HGRCPATH << EOF | |
5 | > [experimental] |
|
5 | > [experimental] | |
6 | > sshpeer.advertise-v2 = true |
|
6 | > sshpeer.advertise-v2 = true | |
7 | > sshserver.support-v2 = true |
|
7 | > sshserver.support-v2 = true | |
8 | > EOF |
|
8 | > EOF | |
9 | #endif |
|
9 | #endif | |
10 |
|
10 | |||
11 | $ cat > bundle2.py << EOF |
|
11 | $ cat > bundle2.py << EOF | |
12 | > """A small extension to test bundle2 pushback parts. |
|
12 | > """A small extension to test bundle2 pushback parts. | |
13 | > Current bundle2 implementation doesn't provide a way to generate those |
|
13 | > Current bundle2 implementation doesn't provide a way to generate those | |
14 | > parts, so they must be created by extensions. |
|
14 | > parts, so they must be created by extensions. | |
15 | > """ |
|
15 | > """ | |
16 | > from __future__ import absolute_import |
|
16 | > from __future__ import absolute_import | |
17 | > from mercurial import bundle2, exchange, pushkey, util |
|
17 | > from mercurial import bundle2, exchange, pushkey, util | |
18 | > def _newhandlechangegroup(op, inpart): |
|
18 | > def _newhandlechangegroup(op, inpart): | |
19 | > """This function wraps the changegroup part handler for getbundle. |
|
19 | > """This function wraps the changegroup part handler for getbundle. | |
20 | > It issues an additional pushkey part to send a new |
|
20 | > It issues an additional pushkey part to send a new | |
21 | > bookmark back to the client""" |
|
21 | > bookmark back to the client""" | |
22 | > result = bundle2.handlechangegroup(op, inpart) |
|
22 | > result = bundle2.handlechangegroup(op, inpart) | |
23 | > if b'pushback' in op.reply.capabilities: |
|
23 | > if b'pushback' in op.reply.capabilities: | |
24 | > params = {b'namespace': b'bookmarks', |
|
24 | > params = {b'namespace': b'bookmarks', | |
25 | > b'key': b'new-server-mark', |
|
25 | > b'key': b'new-server-mark', | |
26 | > b'old': b'', |
|
26 | > b'old': b'', | |
27 | > b'new': b'tip'} |
|
27 | > b'new': b'tip'} | |
28 |
> encodedparams = [(k, pushkey.encode(v)) |
|
28 | > encodedparams = [(k, pushkey.encode(v)) | |
|
29 | > for (k, v) in params.items()] | |||
29 | > op.reply.newpart(b'pushkey', mandatoryparams=encodedparams) |
|
30 | > op.reply.newpart(b'pushkey', mandatoryparams=encodedparams) | |
30 | > else: |
|
31 | > else: | |
31 | > op.reply.newpart(b'output', data=b'pushback not enabled') |
|
32 | > op.reply.newpart(b'output', data=b'pushback not enabled') | |
32 | > return result |
|
33 | > return result | |
33 | > _newhandlechangegroup.params = bundle2.handlechangegroup.params |
|
34 | > _newhandlechangegroup.params = bundle2.handlechangegroup.params | |
34 | > bundle2.parthandlermapping[b'changegroup'] = _newhandlechangegroup |
|
35 | > bundle2.parthandlermapping[b'changegroup'] = _newhandlechangegroup | |
35 | > EOF |
|
36 | > EOF | |
36 |
|
37 | |||
37 | $ cat >> $HGRCPATH <<EOF |
|
38 | $ cat >> $HGRCPATH <<EOF | |
38 | > [ui] |
|
39 | > [ui] | |
39 | > ssh = "$PYTHON" "$TESTDIR/dummyssh" |
|
40 | > ssh = "$PYTHON" "$TESTDIR/dummyssh" | |
40 | > username = nobody <no.reply@example.com> |
|
41 | > username = nobody <no.reply@example.com> | |
41 | > |
|
42 | > | |
42 | > [alias] |
|
43 | > [alias] | |
43 | > tglog = log -G -T "{desc} [{phase}:{node|short}]" |
|
44 | > tglog = log -G -T "{desc} [{phase}:{node|short}]" | |
44 | > EOF |
|
45 | > EOF | |
45 |
|
46 | |||
46 | Set up server repository |
|
47 | Set up server repository | |
47 |
|
48 | |||
48 | $ hg init server |
|
49 | $ hg init server | |
49 | $ cd server |
|
50 | $ cd server | |
50 | $ echo c0 > f0 |
|
51 | $ echo c0 > f0 | |
51 | $ hg commit -Am 0 |
|
52 | $ hg commit -Am 0 | |
52 | adding f0 |
|
53 | adding f0 | |
53 |
|
54 | |||
54 | Set up client repository |
|
55 | Set up client repository | |
55 |
|
56 | |||
56 | $ cd .. |
|
57 | $ cd .. | |
57 | $ hg clone ssh://user@dummy/server client -q |
|
58 | $ hg clone ssh://user@dummy/server client -q | |
58 | $ cd client |
|
59 | $ cd client | |
59 |
|
60 | |||
60 | Enable extension |
|
61 | Enable extension | |
61 | $ cat >> $HGRCPATH <<EOF |
|
62 | $ cat >> $HGRCPATH <<EOF | |
62 | > [extensions] |
|
63 | > [extensions] | |
63 | > bundle2=$TESTTMP/bundle2.py |
|
64 | > bundle2=$TESTTMP/bundle2.py | |
64 | > EOF |
|
65 | > EOF | |
65 |
|
66 | |||
66 | Without config |
|
67 | Without config | |
67 |
|
68 | |||
68 | $ cd ../client |
|
69 | $ cd ../client | |
69 | $ echo c1 > f1 |
|
70 | $ echo c1 > f1 | |
70 | $ hg commit -Am 1 |
|
71 | $ hg commit -Am 1 | |
71 | adding f1 |
|
72 | adding f1 | |
72 | $ hg push |
|
73 | $ hg push | |
73 | pushing to ssh://user@dummy/server |
|
74 | pushing to ssh://user@dummy/server | |
74 | searching for changes |
|
75 | searching for changes | |
75 | remote: adding changesets |
|
76 | remote: adding changesets | |
76 | remote: adding manifests |
|
77 | remote: adding manifests | |
77 | remote: adding file changes |
|
78 | remote: adding file changes | |
78 | remote: added 1 changesets with 1 changes to 1 files |
|
79 | remote: added 1 changesets with 1 changes to 1 files | |
79 | remote: pushback not enabled |
|
80 | remote: pushback not enabled | |
80 | $ hg bookmark |
|
81 | $ hg bookmark | |
81 | no bookmarks set |
|
82 | no bookmarks set | |
82 |
|
83 | |||
83 | $ cd ../server |
|
84 | $ cd ../server | |
84 | $ hg tglog |
|
85 | $ hg tglog | |
85 | o 1 [public:2b9c7234e035] |
|
86 | o 1 [public:2b9c7234e035] | |
86 | | |
|
87 | | | |
87 | @ 0 [public:6cee5c8f3e5b] |
|
88 | @ 0 [public:6cee5c8f3e5b] | |
88 |
|
89 | |||
89 |
|
90 | |||
90 |
|
91 | |||
91 |
|
92 | |||
92 | With config |
|
93 | With config | |
93 |
|
94 | |||
94 | $ cd ../client |
|
95 | $ cd ../client | |
95 | $ echo '[experimental]' >> .hg/hgrc |
|
96 | $ echo '[experimental]' >> .hg/hgrc | |
96 | $ echo 'bundle2.pushback = True' >> .hg/hgrc |
|
97 | $ echo 'bundle2.pushback = True' >> .hg/hgrc | |
97 | $ echo c2 > f2 |
|
98 | $ echo c2 > f2 | |
98 | $ hg commit -Am 2 |
|
99 | $ hg commit -Am 2 | |
99 | adding f2 |
|
100 | adding f2 | |
100 | $ hg push |
|
101 | $ hg push | |
101 | pushing to ssh://user@dummy/server |
|
102 | pushing to ssh://user@dummy/server | |
102 | searching for changes |
|
103 | searching for changes | |
103 | remote: adding changesets |
|
104 | remote: adding changesets | |
104 | remote: adding manifests |
|
105 | remote: adding manifests | |
105 | remote: adding file changes |
|
106 | remote: adding file changes | |
106 | remote: added 1 changesets with 1 changes to 1 files |
|
107 | remote: added 1 changesets with 1 changes to 1 files | |
107 | $ hg bookmark |
|
108 | $ hg bookmark | |
108 | new-server-mark 2:0a76dfb2e179 |
|
109 | new-server-mark 2:0a76dfb2e179 | |
109 |
|
110 | |||
110 | $ cd ../server |
|
111 | $ cd ../server | |
111 | $ hg tglog |
|
112 | $ hg tglog | |
112 | o 2 [public:0a76dfb2e179] |
|
113 | o 2 [public:0a76dfb2e179] | |
113 | | |
|
114 | | | |
114 | o 1 [public:2b9c7234e035] |
|
115 | o 1 [public:2b9c7234e035] | |
115 | | |
|
116 | | | |
116 | @ 0 [public:6cee5c8f3e5b] |
|
117 | @ 0 [public:6cee5c8f3e5b] | |
117 |
|
118 | |||
118 |
|
119 | |||
119 |
|
120 | |||
120 |
|
121 |
General Comments 0
You need to be logged in to leave comments.
Login now