##// END OF EJS Templates
exchangev2: fetch and apply bookmarks...
Gregory Szorc -
r39671:349482d7 default
parent child Browse files
Show More
@@ -15,6 +15,7 b' from .node import ('
15 15 short,
16 16 )
17 17 from . import (
18 bookmarks,
18 19 mdiff,
19 20 phases,
20 21 pycompat,
@@ -51,6 +52,11 b' def pull(pullop):'
51 52 phases.advanceboundary(repo, tr, phases.phasenames.index(phase),
52 53 csetres['nodesbyphase'][phase])
53 54
55 # Write bookmark updates.
56 bookmarks.updatefromremote(repo.ui, repo, csetres['bookmarks'],
57 remote.url(), pullop.gettransaction,
58 explicit=pullop.explicitbookmarks)
59
54 60 def _pullchangesetdiscovery(repo, remote, heads, abortwhenunrelated=True):
55 61 """Determine which changesets need to be pulled."""
56 62
@@ -91,7 +97,7 b' def _fetchchangesets(repo, tr, remote, c'
91 97 with remote.commandexecutor() as e:
92 98 objs = e.callcommand(b'changesetdata', {
93 99 b'noderange': [sorted(common), sorted(remoteheads)],
94 b'fields': {b'parents', b'phase', b'revision'},
100 b'fields': {b'bookmarks', b'parents', b'phase', b'revision'},
95 101 }).result()
96 102
97 103 # The context manager waits on all response data when exiting. So
@@ -124,6 +130,7 b' def _processchangesetdata(repo, tr, objs'
124 130 progress.increment()
125 131
126 132 nodesbyphase = {phase: set() for phase in phases.phasenames}
133 remotebookmarks = {}
127 134
128 135 # addgroup() expects a 7-tuple describing revisions. This normalizes
129 136 # the wire data to that format.
@@ -137,6 +144,9 b' def _processchangesetdata(repo, tr, objs'
137 144 if b'phase' in cset:
138 145 nodesbyphase[cset[b'phase']].add(node)
139 146
147 for mark in cset.get(b'bookmarks', []):
148 remotebookmarks[mark] = node
149
140 150 # Some entries might only be metadata only updates.
141 151 if b'revisionsize' not in cset:
142 152 continue
@@ -164,4 +174,5 b' def _processchangesetdata(repo, tr, objs'
164 174 return {
165 175 'added': added,
166 176 'nodesbyphase': nodesbyphase,
177 'bookmarks': remotebookmarks,
167 178 }
@@ -54,6 +54,7 b' Test basic clone'
54 54 sending 1 commands
55 55 sending command changesetdata: {
56 56 'fields': set([
57 'bookmarks',
57 58 'parents',
58 59 'phase',
59 60 'revision'
@@ -74,6 +75,7 b' Test basic clone'
74 75 add changeset cd2534766bec
75 76 add changeset e96ae20f4188
76 77 add changeset caa2a465451d
78 checking for updated bookmarks
77 79 updating the branch cache
78 80 new changesets 3390ef850073:caa2a465451d (3 drafts)
79 81
@@ -126,6 +128,7 b' Cloning only a specific revision works'
126 128 sending 1 commands
127 129 sending command changesetdata: {
128 130 'fields': set([
131 'bookmarks',
129 132 'parents',
130 133 'phase',
131 134 'revision'
@@ -142,6 +145,7 b' Cloning only a specific revision works'
142 145 received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos)
143 146 add changeset 3390ef850073
144 147 add changeset 4432d83626e8
148 checking for updated bookmarks
145 149 updating the branch cache
146 150 new changesets 3390ef850073:4432d83626e8
147 151
@@ -178,6 +182,7 b' Incremental pull works'
178 182 sending 1 commands
179 183 sending command changesetdata: {
180 184 'fields': set([
185 'bookmarks',
181 186 'parents',
182 187 'phase',
183 188 'revision'
@@ -198,6 +203,7 b' Incremental pull works'
198 203 add changeset cd2534766bec
199 204 add changeset e96ae20f4188
200 205 add changeset caa2a465451d
206 checking for updated bookmarks
201 207 updating the branch cache
202 208 new changesets cd2534766bec:caa2a465451d (3 drafts)
203 209 (run 'hg update' to get a working copy)
@@ -241,6 +247,7 b' Phase-only update works'
241 247 sending 1 commands
242 248 sending command changesetdata: {
243 249 'fields': set([
250 'bookmarks',
244 251 'parents',
245 252 'phase',
246 253 'revision'
@@ -259,6 +266,7 b' Phase-only update works'
259 266 received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation)
260 267 received frame(size=92; request=1; stream=2; streamflags=; type=command-response; flags=continuation)
261 268 received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos)
269 checking for updated bookmarks
262 270 2 local changesets published
263 271 (run 'hg update' to get a working copy)
264 272
@@ -275,3 +283,113 b' Phase-only update works'
275 283
276 284
277 285 $ cd ..
286
287 Bookmarks are transferred on clone
288
289 $ hg -R server-simple bookmark -r 3390ef850073fbc2f0dfff2244342c8e9229013a book-1
290 $ hg -R server-simple bookmark -r cd2534766bece138c7c1afdc6825302f0f62d81f book-2
291
292 $ hg --debug clone -U http://localhost:$HGPORT/ client-bookmarks
293 using http://localhost:$HGPORT/
294 sending capabilities command
295 query 1; heads
296 sending 2 commands
297 sending command heads: {}
298 sending command known: {
299 'nodes': []
300 }
301 received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation)
302 received frame(size=43; request=1; stream=2; streamflags=; type=command-response; flags=continuation)
303 received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos)
304 received frame(size=11; request=3; stream=2; streamflags=; type=command-response; flags=continuation)
305 received frame(size=1; request=3; stream=2; streamflags=; type=command-response; flags=continuation)
306 received frame(size=0; request=3; stream=2; streamflags=; type=command-response; flags=eos)
307 sending 1 commands
308 sending command changesetdata: {
309 'fields': set([
310 'bookmarks',
311 'parents',
312 'phase',
313 'revision'
314 ]),
315 'noderange': [
316 [],
317 [
318 '\xca\xa2\xa4eE\x1d\xd1\xfa\xcd\xa0\xf5\xb1#\x12\xc3UXA\x88\xa1',
319 '\xcd%4vk\xec\xe18\xc7\xc1\xaf\xdch%0/\x0fb\xd8\x1f'
320 ]
321 ]
322 }
323 received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation)
324 received frame(size=909; request=1; stream=2; streamflags=; type=command-response; flags=continuation)
325 received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos)
326 add changeset 3390ef850073
327 add changeset 4432d83626e8
328 add changeset cd2534766bec
329 add changeset e96ae20f4188
330 add changeset caa2a465451d
331 checking for updated bookmarks
332 adding remote bookmark book-1
333 adding remote bookmark book-2
334 updating the branch cache
335 new changesets 3390ef850073:caa2a465451d (1 drafts)
336
337 $ hg -R client-bookmarks bookmarks
338 book-1 0:3390ef850073
339 book-2 2:cd2534766bec
340
341 Server-side bookmark moves are reflected during `hg pull`
342
343 $ hg -R server-simple bookmark -r cd2534766bece138c7c1afdc6825302f0f62d81f book-1
344 moving bookmark 'book-1' forward from 3390ef850073
345
346 $ hg -R client-bookmarks --debug pull
347 pulling from http://localhost:$HGPORT/
348 using http://localhost:$HGPORT/
349 sending capabilities command
350 query 1; heads
351 sending 2 commands
352 sending command heads: {}
353 sending command known: {
354 'nodes': [
355 '\xcd%4vk\xec\xe18\xc7\xc1\xaf\xdch%0/\x0fb\xd8\x1f',
356 '\xca\xa2\xa4eE\x1d\xd1\xfa\xcd\xa0\xf5\xb1#\x12\xc3UXA\x88\xa1'
357 ]
358 }
359 received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation)
360 received frame(size=43; request=1; stream=2; streamflags=; type=command-response; flags=continuation)
361 received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos)
362 received frame(size=11; request=3; stream=2; streamflags=; type=command-response; flags=continuation)
363 received frame(size=3; request=3; stream=2; streamflags=; type=command-response; flags=continuation)
364 received frame(size=0; request=3; stream=2; streamflags=; type=command-response; flags=eos)
365 searching for changes
366 all remote heads known locally
367 sending 1 commands
368 sending command changesetdata: {
369 'fields': set([
370 'bookmarks',
371 'parents',
372 'phase',
373 'revision'
374 ]),
375 'noderange': [
376 [
377 '\xca\xa2\xa4eE\x1d\xd1\xfa\xcd\xa0\xf5\xb1#\x12\xc3UXA\x88\xa1',
378 '\xcd%4vk\xec\xe18\xc7\xc1\xaf\xdch%0/\x0fb\xd8\x1f'
379 ],
380 [
381 '\xca\xa2\xa4eE\x1d\xd1\xfa\xcd\xa0\xf5\xb1#\x12\xc3UXA\x88\xa1',
382 '\xcd%4vk\xec\xe18\xc7\xc1\xaf\xdch%0/\x0fb\xd8\x1f'
383 ]
384 ]
385 }
386 received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation)
387 received frame(size=144; request=1; stream=2; streamflags=; type=command-response; flags=continuation)
388 received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos)
389 checking for updated bookmarks
390 updating bookmark book-1
391 (run 'hg update' to get a working copy)
392
393 $ hg -R client-bookmarks bookmarks
394 book-1 2:cd2534766bec
395 book-2 2:cd2534766bec
General Comments 0
You need to be logged in to leave comments. Login now