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