Show More
@@ -1,181 +1,294 | |||
|
1 | 1 | # exchangev2.py - repository exchange for wire protocol version 2 |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2018 Gregory Szorc <gregory.szorc@gmail.com> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | from __future__ import absolute_import |
|
9 | 9 | |
|
10 | 10 | import weakref |
|
11 | 11 | |
|
12 | 12 | from .i18n import _ |
|
13 | 13 | from .node import ( |
|
14 | 14 | nullid, |
|
15 | 15 | short, |
|
16 | 16 | ) |
|
17 | 17 | from . import ( |
|
18 | 18 | bookmarks, |
|
19 | error, | |
|
19 | 20 | mdiff, |
|
20 | 21 | phases, |
|
21 | 22 | pycompat, |
|
22 | 23 | setdiscovery, |
|
23 | 24 | ) |
|
24 | 25 | |
|
25 | 26 | def pull(pullop): |
|
26 | 27 | """Pull using wire protocol version 2.""" |
|
27 | 28 | repo = pullop.repo |
|
28 | 29 | remote = pullop.remote |
|
29 | 30 | tr = pullop.trmanager.transaction() |
|
30 | 31 | |
|
31 | 32 | # Figure out what needs to be fetched. |
|
32 | 33 | common, fetch, remoteheads = _pullchangesetdiscovery( |
|
33 | 34 | repo, remote, pullop.heads, abortwhenunrelated=pullop.force) |
|
34 | 35 | |
|
35 | 36 | # And fetch the data. |
|
36 | 37 | pullheads = pullop.heads or remoteheads |
|
37 | 38 | csetres = _fetchchangesets(repo, tr, remote, common, fetch, pullheads) |
|
38 | 39 | |
|
39 | 40 | # New revisions are written to the changelog. But all other updates |
|
40 | 41 | # are deferred. Do those now. |
|
41 | 42 | |
|
42 | 43 | # Ensure all new changesets are draft by default. If the repo is |
|
43 | 44 | # publishing, the phase will be adjusted by the loop below. |
|
44 | 45 | if csetres['added']: |
|
45 | 46 | phases.registernew(repo, tr, phases.draft, csetres['added']) |
|
46 | 47 | |
|
47 | 48 | # And adjust the phase of all changesets accordingly. |
|
48 | 49 | for phase in phases.phasenames: |
|
49 | 50 | if phase == b'secret' or not csetres['nodesbyphase'][phase]: |
|
50 | 51 | continue |
|
51 | 52 | |
|
52 | 53 | phases.advanceboundary(repo, tr, phases.phasenames.index(phase), |
|
53 | 54 | csetres['nodesbyphase'][phase]) |
|
54 | 55 | |
|
55 | 56 | # Write bookmark updates. |
|
56 | 57 | bookmarks.updatefromremote(repo.ui, repo, csetres['bookmarks'], |
|
57 | 58 | remote.url(), pullop.gettransaction, |
|
58 | 59 | explicit=pullop.explicitbookmarks) |
|
59 | 60 | |
|
61 | _fetchmanifests(repo, tr, remote, csetres['manifestnodes']) | |
|
62 | ||
|
60 | 63 | def _pullchangesetdiscovery(repo, remote, heads, abortwhenunrelated=True): |
|
61 | 64 | """Determine which changesets need to be pulled.""" |
|
62 | 65 | |
|
63 | 66 | if heads: |
|
64 | 67 | knownnode = repo.changelog.hasnode |
|
65 | 68 | if all(knownnode(head) for head in heads): |
|
66 | 69 | return heads, False, heads |
|
67 | 70 | |
|
68 | 71 | # TODO wire protocol version 2 is capable of more efficient discovery |
|
69 | 72 | # than setdiscovery. Consider implementing something better. |
|
70 | 73 | common, fetch, remoteheads = setdiscovery.findcommonheads( |
|
71 | 74 | repo.ui, repo, remote, abortwhenunrelated=abortwhenunrelated) |
|
72 | 75 | |
|
73 | 76 | common = set(common) |
|
74 | 77 | remoteheads = set(remoteheads) |
|
75 | 78 | |
|
76 | 79 | # If a remote head is filtered locally, put it back in the common set. |
|
77 | 80 | # See the comment in exchange._pulldiscoverychangegroup() for more. |
|
78 | 81 | |
|
79 | 82 | if fetch and remoteheads: |
|
80 | 83 | nodemap = repo.unfiltered().changelog.nodemap |
|
81 | 84 | |
|
82 | 85 | common |= {head for head in remoteheads if head in nodemap} |
|
83 | 86 | |
|
84 | 87 | if set(remoteheads).issubset(common): |
|
85 | 88 | fetch = [] |
|
86 | 89 | |
|
87 | 90 | common.discard(nullid) |
|
88 | 91 | |
|
89 | 92 | return common, fetch, remoteheads |
|
90 | 93 | |
|
91 | 94 | def _fetchchangesets(repo, tr, remote, common, fetch, remoteheads): |
|
92 | 95 | # TODO consider adding a step here where we obtain the DAG shape first |
|
93 | 96 | # (or ask the server to slice changesets into chunks for us) so that |
|
94 | 97 | # we can perform multiple fetches in batches. This will facilitate |
|
95 | 98 | # resuming interrupted clones, higher server-side cache hit rates due |
|
96 | 99 | # to smaller segments, etc. |
|
97 | 100 | with remote.commandexecutor() as e: |
|
98 | 101 | objs = e.callcommand(b'changesetdata', { |
|
99 | 102 | b'noderange': [sorted(common), sorted(remoteheads)], |
|
100 | 103 | b'fields': {b'bookmarks', b'parents', b'phase', b'revision'}, |
|
101 | 104 | }).result() |
|
102 | 105 | |
|
103 | 106 | # The context manager waits on all response data when exiting. So |
|
104 | 107 | # we need to remain in the context manager in order to stream data. |
|
105 | 108 | return _processchangesetdata(repo, tr, objs) |
|
106 | 109 | |
|
107 | 110 | def _processchangesetdata(repo, tr, objs): |
|
108 | 111 | repo.hook('prechangegroup', throw=True, |
|
109 | 112 | **pycompat.strkwargs(tr.hookargs)) |
|
110 | 113 | |
|
111 | 114 | urepo = repo.unfiltered() |
|
112 | 115 | cl = urepo.changelog |
|
113 | 116 | |
|
114 | 117 | cl.delayupdate(tr) |
|
115 | 118 | |
|
116 | 119 | # The first emitted object is a header describing the data that |
|
117 | 120 | # follows. |
|
118 | 121 | meta = next(objs) |
|
119 | 122 | |
|
120 | 123 | progress = repo.ui.makeprogress(_('changesets'), |
|
121 | 124 | unit=_('chunks'), |
|
122 | 125 | total=meta.get(b'totalitems')) |
|
123 | 126 | |
|
127 | manifestnodes = {} | |
|
128 | ||
|
124 | 129 | def linkrev(node): |
|
125 | 130 | repo.ui.debug('add changeset %s\n' % short(node)) |
|
126 | 131 | # Linkrev for changelog is always self. |
|
127 | 132 | return len(cl) |
|
128 | 133 | |
|
129 | 134 | def onchangeset(cl, node): |
|
130 | 135 | progress.increment() |
|
131 | 136 | |
|
137 | revision = cl.changelogrevision(node) | |
|
138 | ||
|
139 | # We need to preserve the mapping of changelog revision to node | |
|
140 | # so we can set the linkrev accordingly when manifests are added. | |
|
141 | manifestnodes[cl.rev(node)] = revision.manifest | |
|
142 | ||
|
132 | 143 | nodesbyphase = {phase: set() for phase in phases.phasenames} |
|
133 | 144 | remotebookmarks = {} |
|
134 | 145 | |
|
135 | 146 | # addgroup() expects a 7-tuple describing revisions. This normalizes |
|
136 | 147 | # the wire data to that format. |
|
137 | 148 | # |
|
138 | 149 | # This loop also aggregates non-revision metadata, such as phase |
|
139 | 150 | # data. |
|
140 | 151 | def iterrevisions(): |
|
141 | 152 | for cset in objs: |
|
142 | 153 | node = cset[b'node'] |
|
143 | 154 | |
|
144 | 155 | if b'phase' in cset: |
|
145 | 156 | nodesbyphase[cset[b'phase']].add(node) |
|
146 | 157 | |
|
147 | 158 | for mark in cset.get(b'bookmarks', []): |
|
148 | 159 | remotebookmarks[mark] = node |
|
149 | 160 | |
|
150 | 161 | # TODO add mechanism for extensions to examine records so they |
|
151 | 162 | # can siphon off custom data fields. |
|
152 | 163 | |
|
153 | 164 | # Some entries might only be metadata only updates. |
|
154 | 165 | if b'revisionsize' not in cset: |
|
155 | 166 | continue |
|
156 | 167 | |
|
157 | 168 | data = next(objs) |
|
158 | 169 | |
|
159 | 170 | yield ( |
|
160 | 171 | node, |
|
161 | 172 | cset[b'parents'][0], |
|
162 | 173 | cset[b'parents'][1], |
|
163 | 174 | # Linknode is always itself for changesets. |
|
164 | 175 | cset[b'node'], |
|
165 | 176 | # We always send full revisions. So delta base is not set. |
|
166 | 177 | nullid, |
|
167 | 178 | mdiff.trivialdiffheader(len(data)) + data, |
|
168 | 179 | # Flags not yet supported. |
|
169 | 180 | 0, |
|
170 | 181 | ) |
|
171 | 182 | |
|
172 | 183 | added = cl.addgroup(iterrevisions(), linkrev, weakref.proxy(tr), |
|
173 | 184 | addrevisioncb=onchangeset) |
|
174 | 185 | |
|
175 | 186 | progress.complete() |
|
176 | 187 | |
|
177 | 188 | return { |
|
178 | 189 | 'added': added, |
|
179 | 190 | 'nodesbyphase': nodesbyphase, |
|
180 | 191 | 'bookmarks': remotebookmarks, |
|
192 | 'manifestnodes': manifestnodes, | |
|
181 | 193 | } |
|
194 | ||
|
195 | def _fetchmanifests(repo, tr, remote, manifestnodes): | |
|
196 | rootmanifest = repo.manifestlog.getstorage(b'') | |
|
197 | ||
|
198 | # Some manifests can be shared between changesets. Filter out revisions | |
|
199 | # we already know about. | |
|
200 | fetchnodes = [] | |
|
201 | linkrevs = {} | |
|
202 | seen = set() | |
|
203 | ||
|
204 | for clrev, node in sorted(manifestnodes.iteritems()): | |
|
205 | if node in seen: | |
|
206 | continue | |
|
207 | ||
|
208 | try: | |
|
209 | rootmanifest.rev(node) | |
|
210 | except error.LookupError: | |
|
211 | fetchnodes.append(node) | |
|
212 | linkrevs[node] = clrev | |
|
213 | ||
|
214 | seen.add(node) | |
|
215 | ||
|
216 | # TODO handle tree manifests | |
|
217 | ||
|
218 | # addgroup() expects 7-tuple describing revisions. This normalizes | |
|
219 | # the wire data to that format. | |
|
220 | def iterrevisions(objs, progress): | |
|
221 | for manifest in objs: | |
|
222 | node = manifest[b'node'] | |
|
223 | ||
|
224 | if b'deltasize' in manifest: | |
|
225 | basenode = manifest[b'deltabasenode'] | |
|
226 | delta = next(objs) | |
|
227 | elif b'revisionsize' in manifest: | |
|
228 | basenode = nullid | |
|
229 | revision = next(objs) | |
|
230 | delta = mdiff.trivialdiffheader(len(revision)) + revision | |
|
231 | else: | |
|
232 | continue | |
|
233 | ||
|
234 | yield ( | |
|
235 | node, | |
|
236 | manifest[b'parents'][0], | |
|
237 | manifest[b'parents'][1], | |
|
238 | # The value passed in is passed to the lookup function passed | |
|
239 | # to addgroup(). We already have a map of manifest node to | |
|
240 | # changelog revision number. So we just pass in the | |
|
241 | # manifest node here and use linkrevs.__getitem__ as the | |
|
242 | # resolution function. | |
|
243 | node, | |
|
244 | basenode, | |
|
245 | delta, | |
|
246 | # Flags not yet supported. | |
|
247 | 0 | |
|
248 | ) | |
|
249 | ||
|
250 | progress.increment() | |
|
251 | ||
|
252 | progress = repo.ui.makeprogress(_('manifests'), unit=_('chunks'), | |
|
253 | total=len(fetchnodes)) | |
|
254 | ||
|
255 | # Fetch manifests 10,000 per command. | |
|
256 | # TODO have server advertise preferences? | |
|
257 | # TODO make size configurable on client? | |
|
258 | batchsize = 10000 | |
|
259 | ||
|
260 | # We send commands 1 at a time to the remote. This is not the most | |
|
261 | # efficient because we incur a round trip at the end of each batch. | |
|
262 | # However, the existing frame-based reactor keeps consuming server | |
|
263 | # data in the background. And this results in response data buffering | |
|
264 | # in memory. This can consume gigabytes of memory. | |
|
265 | # TODO send multiple commands in a request once background buffering | |
|
266 | # issues are resolved. | |
|
267 | ||
|
268 | added = [] | |
|
269 | ||
|
270 | for i in pycompat.xrange(0, len(fetchnodes), batchsize): | |
|
271 | batch = [node for node in fetchnodes[i:i + batchsize]] | |
|
272 | if not batch: | |
|
273 | continue | |
|
274 | ||
|
275 | with remote.commandexecutor() as e: | |
|
276 | objs = e.callcommand(b'manifestdata', { | |
|
277 | b'tree': b'', | |
|
278 | b'nodes': batch, | |
|
279 | b'fields': {b'parents', b'revision'}, | |
|
280 | }).result() | |
|
281 | ||
|
282 | # Chomp off header object. | |
|
283 | next(objs) | |
|
284 | ||
|
285 | added.extend(rootmanifest.addgroup( | |
|
286 | iterrevisions(objs, progress), | |
|
287 | linkrevs.__getitem__, | |
|
288 | weakref.proxy(tr))) | |
|
289 | ||
|
290 | progress.complete() | |
|
291 | ||
|
292 | return { | |
|
293 | 'added': added, | |
|
294 | } |
@@ -1,395 +1,485 | |||
|
1 | 1 | Tests for wire protocol version 2 exchange. |
|
2 | 2 | Tests in this file should be folded into existing tests once protocol |
|
3 | 3 | v2 has enough features that it can be enabled via #testcase in existing |
|
4 | 4 | tests. |
|
5 | 5 | |
|
6 | 6 | $ . $TESTDIR/wireprotohelpers.sh |
|
7 | 7 | $ enablehttpv2client |
|
8 | 8 | |
|
9 | 9 | $ hg init server-simple |
|
10 | 10 | $ enablehttpv2 server-simple |
|
11 | 11 | $ cd server-simple |
|
12 | 12 | $ cat >> .hg/hgrc << EOF |
|
13 | 13 | > [phases] |
|
14 | 14 | > publish = false |
|
15 | 15 | > EOF |
|
16 | 16 | $ echo a0 > a |
|
17 | 17 | $ echo b0 > b |
|
18 | 18 | $ hg -q commit -A -m 'commit 0' |
|
19 | 19 | |
|
20 | 20 | $ echo a1 > a |
|
21 | 21 | $ hg commit -m 'commit 1' |
|
22 | 22 | $ hg phase --public -r . |
|
23 | 23 | $ echo a2 > a |
|
24 | 24 | $ hg commit -m 'commit 2' |
|
25 | 25 | |
|
26 | 26 | $ hg -q up -r 0 |
|
27 | 27 | $ echo b1 > b |
|
28 | 28 | $ hg -q commit -m 'head 2 commit 1' |
|
29 | 29 | $ echo b2 > b |
|
30 | 30 | $ hg -q commit -m 'head 2 commit 2' |
|
31 | 31 | |
|
32 | 32 | $ hg serve -p $HGPORT -d --pid-file hg.pid -E error.log |
|
33 | 33 | $ cat hg.pid > $DAEMON_PIDS |
|
34 | 34 | |
|
35 | 35 | $ cd .. |
|
36 | 36 | |
|
37 | 37 | Test basic clone |
|
38 | 38 | |
|
39 | 39 | $ hg --debug clone -U http://localhost:$HGPORT client-simple |
|
40 | 40 | using http://localhost:$HGPORT/ |
|
41 | 41 | sending capabilities command |
|
42 | 42 | query 1; heads |
|
43 | 43 | sending 2 commands |
|
44 | 44 | sending command heads: {} |
|
45 | 45 | sending command known: { |
|
46 | 46 | 'nodes': [] |
|
47 | 47 | } |
|
48 | 48 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) |
|
49 | 49 | received frame(size=43; request=1; stream=2; streamflags=; type=command-response; flags=continuation) |
|
50 | 50 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
51 | 51 | received frame(size=11; request=3; stream=2; streamflags=; type=command-response; flags=continuation) |
|
52 | 52 | received frame(size=1; request=3; stream=2; streamflags=; type=command-response; flags=continuation) |
|
53 | 53 | received frame(size=0; request=3; stream=2; streamflags=; type=command-response; flags=eos) |
|
54 | 54 | sending 1 commands |
|
55 | 55 | sending command changesetdata: { |
|
56 | 56 | 'fields': set([ |
|
57 | 57 | 'bookmarks', |
|
58 | 58 | 'parents', |
|
59 | 59 | 'phase', |
|
60 | 60 | 'revision' |
|
61 | 61 | ]), |
|
62 | 62 | 'noderange': [ |
|
63 | 63 | [], |
|
64 | 64 | [ |
|
65 | 65 | '\xca\xa2\xa4eE\x1d\xd1\xfa\xcd\xa0\xf5\xb1#\x12\xc3UXA\x88\xa1', |
|
66 | 66 | '\xcd%4vk\xec\xe18\xc7\xc1\xaf\xdch%0/\x0fb\xd8\x1f' |
|
67 | 67 | ] |
|
68 | 68 | ] |
|
69 | 69 | } |
|
70 | 70 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) |
|
71 | 71 | received frame(size=871; request=1; stream=2; streamflags=; type=command-response; flags=continuation) |
|
72 | 72 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
73 | 73 | add changeset 3390ef850073 |
|
74 | 74 | add changeset 4432d83626e8 |
|
75 | 75 | add changeset cd2534766bec |
|
76 | 76 | add changeset e96ae20f4188 |
|
77 | 77 | add changeset caa2a465451d |
|
78 | 78 | checking for updated bookmarks |
|
79 | sending 1 commands | |
|
80 | sending command manifestdata: { | |
|
81 | 'fields': set([ | |
|
82 | 'parents', | |
|
83 | 'revision' | |
|
84 | ]), | |
|
85 | 'nodes': [ | |
|
86 | '\x99/Gy\x02\x9a=\xf8\xd0fm\x00\xbb\x92OicN&A', | |
|
87 | '\xa9\x88\xfbCX>\x87\x1d\x1e\xd5u\x0e\xe0t\xc6\xd8@\xbb\xbf\xc8', | |
|
88 | '\xec\x80NH\x8c \x88\xc25\t\x9a\x10 u\x13\xbe\xcd\xc3\xdd\xa5', | |
|
89 | '\x04\\\x7f9\'\xda\x13\xe7Z\xf8\xf0\xe4\xf0HI\xe4a\xa9x\x0f', | |
|
90 | '7\x9c\xb0\xc2\xe6d\\y\xdd\xc5\x9a\x1dG\'\xa9\xfb\x83\n\xeb&' | |
|
91 | ], | |
|
92 | 'tree': '' | |
|
93 | } | |
|
94 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) | |
|
95 | received frame(size=922; request=1; stream=2; streamflags=; type=command-response; flags=continuation) | |
|
96 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) | |
|
79 | 97 | updating the branch cache |
|
80 | 98 | new changesets 3390ef850073:caa2a465451d (3 drafts) |
|
81 | 99 | |
|
82 | 100 | All changesets should have been transferred |
|
83 | 101 | |
|
84 | 102 | $ hg -R client-simple debugindex -c |
|
85 | 103 | rev linkrev nodeid p1 p2 |
|
86 | 104 | 0 0 3390ef850073 000000000000 000000000000 |
|
87 | 105 | 1 1 4432d83626e8 3390ef850073 000000000000 |
|
88 | 106 | 2 2 cd2534766bec 4432d83626e8 000000000000 |
|
89 | 107 | 3 3 e96ae20f4188 3390ef850073 000000000000 |
|
90 | 108 | 4 4 caa2a465451d e96ae20f4188 000000000000 |
|
91 | 109 | |
|
92 | 110 | $ hg -R client-simple log -G -T '{rev} {node} {phase}\n' |
|
93 | 111 | o 4 caa2a465451dd1facda0f5b12312c355584188a1 draft |
|
94 | 112 | | |
|
95 | 113 | o 3 e96ae20f4188487b9ae4ef3941c27c81143146e5 draft |
|
96 | 114 | | |
|
97 | 115 | | o 2 cd2534766bece138c7c1afdc6825302f0f62d81f draft |
|
98 | 116 | | | |
|
99 | 117 | | o 1 4432d83626e8a98655f062ec1f2a43b07f7fbbb0 public |
|
100 | 118 | |/ |
|
101 | 119 | o 0 3390ef850073fbc2f0dfff2244342c8e9229013a public |
|
102 | 120 | |
|
103 | 121 | |
|
122 | All manifests should have been transferred | |
|
123 | ||
|
124 | $ hg -R client-simple debugindex -m | |
|
125 | rev linkrev nodeid p1 p2 | |
|
126 | 0 0 992f4779029a 000000000000 000000000000 | |
|
127 | 1 1 a988fb43583e 992f4779029a 000000000000 | |
|
128 | 2 2 ec804e488c20 a988fb43583e 000000000000 | |
|
129 | 3 3 045c7f3927da 992f4779029a 000000000000 | |
|
130 | 4 4 379cb0c2e664 045c7f3927da 000000000000 | |
|
131 | ||
|
104 | 132 | Cloning only a specific revision works |
|
105 | 133 | |
|
106 | 134 | $ hg --debug clone -U -r 4432d83626e8 http://localhost:$HGPORT client-singlehead |
|
107 | 135 | using http://localhost:$HGPORT/ |
|
108 | 136 | sending capabilities command |
|
109 | 137 | sending 1 commands |
|
110 | 138 | sending command lookup: { |
|
111 | 139 | 'key': '4432d83626e8' |
|
112 | 140 | } |
|
113 | 141 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) |
|
114 | 142 | received frame(size=21; request=1; stream=2; streamflags=; type=command-response; flags=continuation) |
|
115 | 143 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
116 | 144 | query 1; heads |
|
117 | 145 | sending 2 commands |
|
118 | 146 | sending command heads: {} |
|
119 | 147 | sending command known: { |
|
120 | 148 | 'nodes': [] |
|
121 | 149 | } |
|
122 | 150 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) |
|
123 | 151 | received frame(size=43; request=1; stream=2; streamflags=; type=command-response; flags=continuation) |
|
124 | 152 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
125 | 153 | received frame(size=11; request=3; stream=2; streamflags=; type=command-response; flags=continuation) |
|
126 | 154 | received frame(size=1; request=3; stream=2; streamflags=; type=command-response; flags=continuation) |
|
127 | 155 | received frame(size=0; request=3; stream=2; streamflags=; type=command-response; flags=eos) |
|
128 | 156 | sending 1 commands |
|
129 | 157 | sending command changesetdata: { |
|
130 | 158 | 'fields': set([ |
|
131 | 159 | 'bookmarks', |
|
132 | 160 | 'parents', |
|
133 | 161 | 'phase', |
|
134 | 162 | 'revision' |
|
135 | 163 | ]), |
|
136 | 164 | 'noderange': [ |
|
137 | 165 | [], |
|
138 | 166 | [ |
|
139 | 167 | 'D2\xd86&\xe8\xa9\x86U\xf0b\xec\x1f*C\xb0\x7f\x7f\xbb\xb0' |
|
140 | 168 | ] |
|
141 | 169 | ] |
|
142 | 170 | } |
|
143 | 171 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) |
|
144 | 172 | received frame(size=353; request=1; stream=2; streamflags=; type=command-response; flags=continuation) |
|
145 | 173 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
146 | 174 | add changeset 3390ef850073 |
|
147 | 175 | add changeset 4432d83626e8 |
|
148 | 176 | checking for updated bookmarks |
|
177 | sending 1 commands | |
|
178 | sending command manifestdata: { | |
|
179 | 'fields': set([ | |
|
180 | 'parents', | |
|
181 | 'revision' | |
|
182 | ]), | |
|
183 | 'nodes': [ | |
|
184 | '\x99/Gy\x02\x9a=\xf8\xd0fm\x00\xbb\x92OicN&A', | |
|
185 | '\xa9\x88\xfbCX>\x87\x1d\x1e\xd5u\x0e\xe0t\xc6\xd8@\xbb\xbf\xc8' | |
|
186 | ], | |
|
187 | 'tree': '' | |
|
188 | } | |
|
189 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) | |
|
190 | received frame(size=376; request=1; stream=2; streamflags=; type=command-response; flags=continuation) | |
|
191 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) | |
|
149 | 192 | updating the branch cache |
|
150 | 193 | new changesets 3390ef850073:4432d83626e8 |
|
151 | 194 | |
|
152 | 195 | $ cd client-singlehead |
|
153 | 196 | |
|
154 | 197 | $ hg log -G -T '{rev} {node} {phase}\n' |
|
155 | 198 | o 1 4432d83626e8a98655f062ec1f2a43b07f7fbbb0 public |
|
156 | 199 | | |
|
157 | 200 | o 0 3390ef850073fbc2f0dfff2244342c8e9229013a public |
|
158 | 201 | |
|
159 | 202 | |
|
203 | $ hg debugindex -m | |
|
204 | rev linkrev nodeid p1 p2 | |
|
205 | 0 0 992f4779029a 000000000000 000000000000 | |
|
206 | 1 1 a988fb43583e 992f4779029a 000000000000 | |
|
207 | ||
|
160 | 208 | Incremental pull works |
|
161 | 209 | |
|
162 | 210 | $ hg --debug pull |
|
163 | 211 | pulling from http://localhost:$HGPORT/ |
|
164 | 212 | using http://localhost:$HGPORT/ |
|
165 | 213 | sending capabilities command |
|
166 | 214 | query 1; heads |
|
167 | 215 | sending 2 commands |
|
168 | 216 | sending command heads: {} |
|
169 | 217 | sending command known: { |
|
170 | 218 | 'nodes': [ |
|
171 | 219 | 'D2\xd86&\xe8\xa9\x86U\xf0b\xec\x1f*C\xb0\x7f\x7f\xbb\xb0' |
|
172 | 220 | ] |
|
173 | 221 | } |
|
174 | 222 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) |
|
175 | 223 | received frame(size=43; request=1; stream=2; streamflags=; type=command-response; flags=continuation) |
|
176 | 224 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
177 | 225 | received frame(size=11; request=3; stream=2; streamflags=; type=command-response; flags=continuation) |
|
178 | 226 | received frame(size=2; request=3; stream=2; streamflags=; type=command-response; flags=continuation) |
|
179 | 227 | received frame(size=0; request=3; stream=2; streamflags=; type=command-response; flags=eos) |
|
180 | 228 | searching for changes |
|
181 | 229 | all local heads known remotely |
|
182 | 230 | sending 1 commands |
|
183 | 231 | sending command changesetdata: { |
|
184 | 232 | 'fields': set([ |
|
185 | 233 | 'bookmarks', |
|
186 | 234 | 'parents', |
|
187 | 235 | 'phase', |
|
188 | 236 | 'revision' |
|
189 | 237 | ]), |
|
190 | 238 | 'noderange': [ |
|
191 | 239 | [ |
|
192 | 240 | 'D2\xd86&\xe8\xa9\x86U\xf0b\xec\x1f*C\xb0\x7f\x7f\xbb\xb0' |
|
193 | 241 | ], |
|
194 | 242 | [ |
|
195 | 243 | '\xca\xa2\xa4eE\x1d\xd1\xfa\xcd\xa0\xf5\xb1#\x12\xc3UXA\x88\xa1', |
|
196 | 244 | '\xcd%4vk\xec\xe18\xc7\xc1\xaf\xdch%0/\x0fb\xd8\x1f' |
|
197 | 245 | ] |
|
198 | 246 | ] |
|
199 | 247 | } |
|
200 | 248 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) |
|
201 | 249 | received frame(size=571; request=1; stream=2; streamflags=; type=command-response; flags=continuation) |
|
202 | 250 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
203 | 251 | add changeset cd2534766bec |
|
204 | 252 | add changeset e96ae20f4188 |
|
205 | 253 | add changeset caa2a465451d |
|
206 | 254 | checking for updated bookmarks |
|
255 | sending 1 commands | |
|
256 | sending command manifestdata: { | |
|
257 | 'fields': set([ | |
|
258 | 'parents', | |
|
259 | 'revision' | |
|
260 | ]), | |
|
261 | 'nodes': [ | |
|
262 | '\xec\x80NH\x8c \x88\xc25\t\x9a\x10 u\x13\xbe\xcd\xc3\xdd\xa5', | |
|
263 | '\x04\\\x7f9\'\xda\x13\xe7Z\xf8\xf0\xe4\xf0HI\xe4a\xa9x\x0f', | |
|
264 | '7\x9c\xb0\xc2\xe6d\\y\xdd\xc5\x9a\x1dG\'\xa9\xfb\x83\n\xeb&' | |
|
265 | ], | |
|
266 | 'tree': '' | |
|
267 | } | |
|
268 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) | |
|
269 | received frame(size=559; request=1; stream=2; streamflags=; type=command-response; flags=continuation) | |
|
270 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) | |
|
207 | 271 | updating the branch cache |
|
208 | 272 | new changesets cd2534766bec:caa2a465451d (3 drafts) |
|
209 | 273 | (run 'hg update' to get a working copy) |
|
210 | 274 | |
|
211 | 275 | $ hg log -G -T '{rev} {node} {phase}\n' |
|
212 | 276 | o 4 caa2a465451dd1facda0f5b12312c355584188a1 draft |
|
213 | 277 | | |
|
214 | 278 | o 3 e96ae20f4188487b9ae4ef3941c27c81143146e5 draft |
|
215 | 279 | | |
|
216 | 280 | | o 2 cd2534766bece138c7c1afdc6825302f0f62d81f draft |
|
217 | 281 | | | |
|
218 | 282 | | o 1 4432d83626e8a98655f062ec1f2a43b07f7fbbb0 public |
|
219 | 283 | |/ |
|
220 | 284 | o 0 3390ef850073fbc2f0dfff2244342c8e9229013a public |
|
221 | 285 | |
|
222 | 286 | |
|
287 | $ hg debugindex -m | |
|
288 | rev linkrev nodeid p1 p2 | |
|
289 | 0 0 992f4779029a 000000000000 000000000000 | |
|
290 | 1 1 a988fb43583e 992f4779029a 000000000000 | |
|
291 | 2 2 ec804e488c20 a988fb43583e 000000000000 | |
|
292 | 3 3 045c7f3927da 992f4779029a 000000000000 | |
|
293 | 4 4 379cb0c2e664 045c7f3927da 000000000000 | |
|
294 | ||
|
223 | 295 | Phase-only update works |
|
224 | 296 | |
|
225 | 297 | $ hg -R ../server-simple phase --public -r caa2a465451dd |
|
226 | 298 | $ hg --debug pull |
|
227 | 299 | pulling from http://localhost:$HGPORT/ |
|
228 | 300 | using http://localhost:$HGPORT/ |
|
229 | 301 | sending capabilities command |
|
230 | 302 | query 1; heads |
|
231 | 303 | sending 2 commands |
|
232 | 304 | sending command heads: {} |
|
233 | 305 | sending command known: { |
|
234 | 306 | 'nodes': [ |
|
235 | 307 | '\xcd%4vk\xec\xe18\xc7\xc1\xaf\xdch%0/\x0fb\xd8\x1f', |
|
236 | 308 | '\xca\xa2\xa4eE\x1d\xd1\xfa\xcd\xa0\xf5\xb1#\x12\xc3UXA\x88\xa1' |
|
237 | 309 | ] |
|
238 | 310 | } |
|
239 | 311 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) |
|
240 | 312 | received frame(size=43; request=1; stream=2; streamflags=; type=command-response; flags=continuation) |
|
241 | 313 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
242 | 314 | received frame(size=11; request=3; stream=2; streamflags=; type=command-response; flags=continuation) |
|
243 | 315 | received frame(size=3; request=3; stream=2; streamflags=; type=command-response; flags=continuation) |
|
244 | 316 | received frame(size=0; request=3; stream=2; streamflags=; type=command-response; flags=eos) |
|
245 | 317 | searching for changes |
|
246 | 318 | all remote heads known locally |
|
247 | 319 | sending 1 commands |
|
248 | 320 | sending command changesetdata: { |
|
249 | 321 | 'fields': set([ |
|
250 | 322 | 'bookmarks', |
|
251 | 323 | 'parents', |
|
252 | 324 | 'phase', |
|
253 | 325 | 'revision' |
|
254 | 326 | ]), |
|
255 | 327 | 'noderange': [ |
|
256 | 328 | [ |
|
257 | 329 | '\xca\xa2\xa4eE\x1d\xd1\xfa\xcd\xa0\xf5\xb1#\x12\xc3UXA\x88\xa1', |
|
258 | 330 | '\xcd%4vk\xec\xe18\xc7\xc1\xaf\xdch%0/\x0fb\xd8\x1f' |
|
259 | 331 | ], |
|
260 | 332 | [ |
|
261 | 333 | '\xca\xa2\xa4eE\x1d\xd1\xfa\xcd\xa0\xf5\xb1#\x12\xc3UXA\x88\xa1', |
|
262 | 334 | '\xcd%4vk\xec\xe18\xc7\xc1\xaf\xdch%0/\x0fb\xd8\x1f' |
|
263 | 335 | ] |
|
264 | 336 | ] |
|
265 | 337 | } |
|
266 | 338 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) |
|
267 | 339 | received frame(size=92; request=1; stream=2; streamflags=; type=command-response; flags=continuation) |
|
268 | 340 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
269 | 341 | checking for updated bookmarks |
|
270 | 342 | 2 local changesets published |
|
271 | 343 | (run 'hg update' to get a working copy) |
|
272 | 344 | |
|
273 | 345 | $ hg log -G -T '{rev} {node} {phase}\n' |
|
274 | 346 | o 4 caa2a465451dd1facda0f5b12312c355584188a1 public |
|
275 | 347 | | |
|
276 | 348 | o 3 e96ae20f4188487b9ae4ef3941c27c81143146e5 public |
|
277 | 349 | | |
|
278 | 350 | | o 2 cd2534766bece138c7c1afdc6825302f0f62d81f draft |
|
279 | 351 | | | |
|
280 | 352 | | o 1 4432d83626e8a98655f062ec1f2a43b07f7fbbb0 public |
|
281 | 353 | |/ |
|
282 | 354 | o 0 3390ef850073fbc2f0dfff2244342c8e9229013a public |
|
283 | 355 | |
|
284 | 356 | |
|
285 | 357 | $ cd .. |
|
286 | 358 | |
|
287 | 359 | Bookmarks are transferred on clone |
|
288 | 360 | |
|
289 | 361 | $ hg -R server-simple bookmark -r 3390ef850073fbc2f0dfff2244342c8e9229013a book-1 |
|
290 | 362 | $ hg -R server-simple bookmark -r cd2534766bece138c7c1afdc6825302f0f62d81f book-2 |
|
291 | 363 | |
|
292 | 364 | $ hg --debug clone -U http://localhost:$HGPORT/ client-bookmarks |
|
293 | 365 | using http://localhost:$HGPORT/ |
|
294 | 366 | sending capabilities command |
|
295 | 367 | query 1; heads |
|
296 | 368 | sending 2 commands |
|
297 | 369 | sending command heads: {} |
|
298 | 370 | sending command known: { |
|
299 | 371 | 'nodes': [] |
|
300 | 372 | } |
|
301 | 373 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) |
|
302 | 374 | received frame(size=43; request=1; stream=2; streamflags=; type=command-response; flags=continuation) |
|
303 | 375 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
304 | 376 | received frame(size=11; request=3; stream=2; streamflags=; type=command-response; flags=continuation) |
|
305 | 377 | received frame(size=1; request=3; stream=2; streamflags=; type=command-response; flags=continuation) |
|
306 | 378 | received frame(size=0; request=3; stream=2; streamflags=; type=command-response; flags=eos) |
|
307 | 379 | sending 1 commands |
|
308 | 380 | sending command changesetdata: { |
|
309 | 381 | 'fields': set([ |
|
310 | 382 | 'bookmarks', |
|
311 | 383 | 'parents', |
|
312 | 384 | 'phase', |
|
313 | 385 | 'revision' |
|
314 | 386 | ]), |
|
315 | 387 | 'noderange': [ |
|
316 | 388 | [], |
|
317 | 389 | [ |
|
318 | 390 | '\xca\xa2\xa4eE\x1d\xd1\xfa\xcd\xa0\xf5\xb1#\x12\xc3UXA\x88\xa1', |
|
319 | 391 | '\xcd%4vk\xec\xe18\xc7\xc1\xaf\xdch%0/\x0fb\xd8\x1f' |
|
320 | 392 | ] |
|
321 | 393 | ] |
|
322 | 394 | } |
|
323 | 395 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) |
|
324 | 396 | received frame(size=909; request=1; stream=2; streamflags=; type=command-response; flags=continuation) |
|
325 | 397 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
326 | 398 | add changeset 3390ef850073 |
|
327 | 399 | add changeset 4432d83626e8 |
|
328 | 400 | add changeset cd2534766bec |
|
329 | 401 | add changeset e96ae20f4188 |
|
330 | 402 | add changeset caa2a465451d |
|
331 | 403 | checking for updated bookmarks |
|
332 | 404 | adding remote bookmark book-1 |
|
333 | 405 | adding remote bookmark book-2 |
|
406 | sending 1 commands | |
|
407 | sending command manifestdata: { | |
|
408 | 'fields': set([ | |
|
409 | 'parents', | |
|
410 | 'revision' | |
|
411 | ]), | |
|
412 | 'nodes': [ | |
|
413 | '\x99/Gy\x02\x9a=\xf8\xd0fm\x00\xbb\x92OicN&A', | |
|
414 | '\xa9\x88\xfbCX>\x87\x1d\x1e\xd5u\x0e\xe0t\xc6\xd8@\xbb\xbf\xc8', | |
|
415 | '\xec\x80NH\x8c \x88\xc25\t\x9a\x10 u\x13\xbe\xcd\xc3\xdd\xa5', | |
|
416 | '\x04\\\x7f9\'\xda\x13\xe7Z\xf8\xf0\xe4\xf0HI\xe4a\xa9x\x0f', | |
|
417 | '7\x9c\xb0\xc2\xe6d\\y\xdd\xc5\x9a\x1dG\'\xa9\xfb\x83\n\xeb&' | |
|
418 | ], | |
|
419 | 'tree': '' | |
|
420 | } | |
|
421 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) | |
|
422 | received frame(size=922; request=1; stream=2; streamflags=; type=command-response; flags=continuation) | |
|
423 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) | |
|
334 | 424 | updating the branch cache |
|
335 | 425 | new changesets 3390ef850073:caa2a465451d (1 drafts) |
|
336 | 426 | |
|
337 | 427 | $ hg -R client-bookmarks bookmarks |
|
338 | 428 | book-1 0:3390ef850073 |
|
339 | 429 | book-2 2:cd2534766bec |
|
340 | 430 | |
|
341 | 431 | Server-side bookmark moves are reflected during `hg pull` |
|
342 | 432 | |
|
343 | 433 | $ hg -R server-simple bookmark -r cd2534766bece138c7c1afdc6825302f0f62d81f book-1 |
|
344 | 434 | moving bookmark 'book-1' forward from 3390ef850073 |
|
345 | 435 | |
|
346 | 436 | $ hg -R client-bookmarks --debug pull |
|
347 | 437 | pulling from http://localhost:$HGPORT/ |
|
348 | 438 | using http://localhost:$HGPORT/ |
|
349 | 439 | sending capabilities command |
|
350 | 440 | query 1; heads |
|
351 | 441 | sending 2 commands |
|
352 | 442 | sending command heads: {} |
|
353 | 443 | sending command known: { |
|
354 | 444 | 'nodes': [ |
|
355 | 445 | '\xcd%4vk\xec\xe18\xc7\xc1\xaf\xdch%0/\x0fb\xd8\x1f', |
|
356 | 446 | '\xca\xa2\xa4eE\x1d\xd1\xfa\xcd\xa0\xf5\xb1#\x12\xc3UXA\x88\xa1' |
|
357 | 447 | ] |
|
358 | 448 | } |
|
359 | 449 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) |
|
360 | 450 | received frame(size=43; request=1; stream=2; streamflags=; type=command-response; flags=continuation) |
|
361 | 451 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
362 | 452 | received frame(size=11; request=3; stream=2; streamflags=; type=command-response; flags=continuation) |
|
363 | 453 | received frame(size=3; request=3; stream=2; streamflags=; type=command-response; flags=continuation) |
|
364 | 454 | received frame(size=0; request=3; stream=2; streamflags=; type=command-response; flags=eos) |
|
365 | 455 | searching for changes |
|
366 | 456 | all remote heads known locally |
|
367 | 457 | sending 1 commands |
|
368 | 458 | sending command changesetdata: { |
|
369 | 459 | 'fields': set([ |
|
370 | 460 | 'bookmarks', |
|
371 | 461 | 'parents', |
|
372 | 462 | 'phase', |
|
373 | 463 | 'revision' |
|
374 | 464 | ]), |
|
375 | 465 | 'noderange': [ |
|
376 | 466 | [ |
|
377 | 467 | '\xca\xa2\xa4eE\x1d\xd1\xfa\xcd\xa0\xf5\xb1#\x12\xc3UXA\x88\xa1', |
|
378 | 468 | '\xcd%4vk\xec\xe18\xc7\xc1\xaf\xdch%0/\x0fb\xd8\x1f' |
|
379 | 469 | ], |
|
380 | 470 | [ |
|
381 | 471 | '\xca\xa2\xa4eE\x1d\xd1\xfa\xcd\xa0\xf5\xb1#\x12\xc3UXA\x88\xa1', |
|
382 | 472 | '\xcd%4vk\xec\xe18\xc7\xc1\xaf\xdch%0/\x0fb\xd8\x1f' |
|
383 | 473 | ] |
|
384 | 474 | ] |
|
385 | 475 | } |
|
386 | 476 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) |
|
387 | 477 | received frame(size=144; request=1; stream=2; streamflags=; type=command-response; flags=continuation) |
|
388 | 478 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
389 | 479 | checking for updated bookmarks |
|
390 | 480 | updating bookmark book-1 |
|
391 | 481 | (run 'hg update' to get a working copy) |
|
392 | 482 | |
|
393 | 483 | $ hg -R client-bookmarks bookmarks |
|
394 | 484 | book-1 2:cd2534766bec |
|
395 | 485 | book-2 2:cd2534766bec |
General Comments 0
You need to be logged in to leave comments.
Login now