Show More
@@ -1587,6 +1587,8 b' class localrepository(repo.repository):' | |||
|
1587 | 1587 | cg, remote_heads, fut = discovery.prepush(self, remote, force, |
|
1588 | 1588 | revs, newbranch) |
|
1589 | 1589 | ret = remote_heads |
|
1590 | # create a callback for addchangegroup. | |
|
1591 | # If will be used branch of the conditionnal too. | |
|
1590 | 1592 | if cg is not None: |
|
1591 | 1593 | if unbundle: |
|
1592 | 1594 | # local repo finds heads on server, finds out what |
@@ -1601,9 +1603,41 b' class localrepository(repo.repository):' | |||
|
1601 | 1603 | else: |
|
1602 | 1604 | # we return an integer indicating remote head count change |
|
1603 | 1605 | ret = remote.addchangegroup(cg, 'push', self.url()) |
|
1604 | # if we don't push, the common data is already useful | |
|
1605 | # everything exchange is public for now | |
|
1606 | phases.advanceboundary(self, 0, fut) | |
|
1606 | ||
|
1607 | # even when we don't push, exchanging phase data is useful | |
|
1608 | remotephases = remote.listkeys('phases') | |
|
1609 | if not remotephases: # old server or public only repo | |
|
1610 | phases.advanceboundary(self, 0, fut) | |
|
1611 | # don't push any phase data as there is nothing to push | |
|
1612 | else: | |
|
1613 | ana = phases.analyzeremotephases(self, fut, remotephases) | |
|
1614 | rheads, rroots = ana | |
|
1615 | ### Apply remote phase on local | |
|
1616 | if remotephases.get('publishing', False): | |
|
1617 | phases.advanceboundary(self, 0, fut) | |
|
1618 | else: # publish = False | |
|
1619 | for phase, rpheads in enumerate(rheads): | |
|
1620 | phases.advanceboundary(self, phase, rpheads) | |
|
1621 | ### Apply local phase on remote | |
|
1622 | # | |
|
1623 | # XXX If push failed we should use strict common and not | |
|
1624 | # future to avoir pushing phase data on unknown changeset. | |
|
1625 | # This is to done later. | |
|
1626 | futctx = [self[n] for n in fut if n != nullid] | |
|
1627 | for phase in phases.trackedphases[::-1]: | |
|
1628 | prevphase = phase -1 | |
|
1629 | # get all candidate for head in previous phase | |
|
1630 | inprev = [ctx for ctx in futctx | |
|
1631 | if ctx.phase() == prevphase] | |
|
1632 | for newremotehead in self.set('heads(%ld & (%ln::))', | |
|
1633 | inprev, rroots[phase]): | |
|
1634 | r = remote.pushkey('phases', | |
|
1635 | newremotehead.hex(), | |
|
1636 | str(phase), str(prevphase)) | |
|
1637 | if not r: | |
|
1638 | self.ui.warn(_('updating phase of %s' | |
|
1639 | 'to %s failed!\n') | |
|
1640 | % (newremotehead, prevphase)) | |
|
1607 | 1641 | finally: |
|
1608 | 1642 | locallock.release() |
|
1609 | 1643 | finally: |
@@ -179,6 +179,7 b' pushkey hook' | |||
|
179 | 179 | pushing to ../a |
|
180 | 180 | searching for changes |
|
181 | 181 | no changes found |
|
182 | pushkey hook: HG_KEY=07f3376c1e655977439df2a814e3cc14b27abac2 HG_NAMESPACE=phases HG_NEW=0 HG_OLD=1 HG_RET=1 | |
|
182 | 183 | exporting bookmark foo |
|
183 | 184 | pushkey hook: HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_RET=1 |
|
184 | 185 | $ cd ../a |
@@ -192,7 +193,7 b' listkeys hook' | |||
|
192 | 193 | pulling from ../a |
|
193 | 194 | listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} |
|
194 | 195 | no changes found |
|
195 |
listkeys hook: HG_NAMESPACE=phases HG_VALUES={' |
|
|
196 | listkeys hook: HG_NAMESPACE=phases HG_VALUES={'539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10': '1', 'publishing': 'True'} | |
|
196 | 197 | listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} |
|
197 | 198 | importing bookmark bar |
|
198 | 199 | $ cd ../a |
@@ -206,6 +207,7 b' test that prepushkey can prevent incomin' | |||
|
206 | 207 | pushing to ../a |
|
207 | 208 | searching for changes |
|
208 | 209 | no changes found |
|
210 | listkeys hook: HG_NAMESPACE=phases HG_VALUES={'539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10': '1', 'publishing': 'True'} | |
|
209 | 211 | listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} |
|
210 | 212 | listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} |
|
211 | 213 | exporting bookmark baz |
@@ -270,3 +270,216 b' pulling back into original repo' | |||
|
270 | 270 | 1 0 a-B - 548a3d25dbf0 |
|
271 | 271 | 0 0 a-A - 054250a37db4 |
|
272 | 272 | $ cd .. |
|
273 | ||
|
274 | Push | |
|
275 | ```` | |
|
276 | ||
|
277 | initial setup | |
|
278 | ||
|
279 | $ cd alpha | |
|
280 | $ hg glog | |
|
281 | o changeset: 6:145e75495359 | |
|
282 | | tag: tip | |
|
283 | | user: test | |
|
284 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
285 | | summary: n-B | |
|
286 | | | |
|
287 | o changeset: 5:d6bcb4f74035 | |
|
288 | | user: test | |
|
289 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
290 | | summary: n-A | |
|
291 | | | |
|
292 | o changeset: 4:f54f1bb90ff3 | |
|
293 | | parent: 1:548a3d25dbf0 | |
|
294 | | user: test | |
|
295 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
296 | | summary: b-A | |
|
297 | | | |
|
298 | | @ changeset: 3:b555f63b6063 | |
|
299 | | | user: test | |
|
300 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
301 | | | summary: a-D | |
|
302 | | | | |
|
303 | | o changeset: 2:54acac6f23ab | |
|
304 | |/ user: test | |
|
305 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
306 | | summary: a-C | |
|
307 | | | |
|
308 | o changeset: 1:548a3d25dbf0 | |
|
309 | | user: test | |
|
310 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
311 | | summary: a-B | |
|
312 | | | |
|
313 | o changeset: 0:054250a37db4 | |
|
314 | user: test | |
|
315 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
316 | summary: a-A | |
|
317 | ||
|
318 | $ mkcommit a-E | |
|
319 | $ mkcommit a-F | |
|
320 | $ mkcommit a-G | |
|
321 | $ hg up d6bcb4f74035 -q | |
|
322 | $ mkcommit a-H | |
|
323 | created new head | |
|
324 | $ hgph | |
|
325 | 10 1 a-H - 967b449fbc94 | |
|
326 | 9 1 a-G - 3e27b6f1eee1 | |
|
327 | 8 1 a-F - b740e3e5c05d | |
|
328 | 7 1 a-E - e9f537e46dea | |
|
329 | 6 0 n-B - 145e75495359 | |
|
330 | 5 0 n-A - d6bcb4f74035 | |
|
331 | 4 0 b-A - f54f1bb90ff3 | |
|
332 | 3 0 a-D - b555f63b6063 | |
|
333 | 2 0 a-C - 54acac6f23ab | |
|
334 | 1 0 a-B - 548a3d25dbf0 | |
|
335 | 0 0 a-A - 054250a37db4 | |
|
336 | ||
|
337 | Pushing to Publish=False (unknown changeset) | |
|
338 | ||
|
339 | $ hg push ../mu -r b740e3e5c05d # a-F | |
|
340 | pushing to ../mu | |
|
341 | searching for changes | |
|
342 | adding changesets | |
|
343 | adding manifests | |
|
344 | adding file changes | |
|
345 | added 2 changesets with 2 changes to 2 files | |
|
346 | $ hgph | |
|
347 | 10 1 a-H - 967b449fbc94 | |
|
348 | 9 1 a-G - 3e27b6f1eee1 | |
|
349 | 8 1 a-F - b740e3e5c05d | |
|
350 | 7 1 a-E - e9f537e46dea | |
|
351 | 6 0 n-B - 145e75495359 | |
|
352 | 5 0 n-A - d6bcb4f74035 | |
|
353 | 4 0 b-A - f54f1bb90ff3 | |
|
354 | 3 0 a-D - b555f63b6063 | |
|
355 | 2 0 a-C - 54acac6f23ab | |
|
356 | 1 0 a-B - 548a3d25dbf0 | |
|
357 | 0 0 a-A - 054250a37db4 | |
|
358 | ||
|
359 | $ cd ../mu | |
|
360 | $ hgph # d6bcb4f74035 and 145e75495359 changed because common is too smart | |
|
361 | 8 1 a-F - b740e3e5c05d | |
|
362 | 7 1 a-E - e9f537e46dea | |
|
363 | 6 0 n-B - 145e75495359 | |
|
364 | 5 0 n-A - d6bcb4f74035 | |
|
365 | 4 0 a-D - b555f63b6063 | |
|
366 | 3 0 a-C - 54acac6f23ab | |
|
367 | 2 0 b-A - f54f1bb90ff3 | |
|
368 | 1 0 a-B - 548a3d25dbf0 | |
|
369 | 0 0 a-A - 054250a37db4 | |
|
370 | ||
|
371 | Pushing to Publish=True (unknown changeset) | |
|
372 | ||
|
373 | $ hg push ../beta -r b740e3e5c05d | |
|
374 | pushing to ../beta | |
|
375 | searching for changes | |
|
376 | adding changesets | |
|
377 | adding manifests | |
|
378 | adding file changes | |
|
379 | added 2 changesets with 2 changes to 2 files | |
|
380 | $ hgph # again d6bcb4f74035 and 145e75495359 changed because common is too smart | |
|
381 | 8 0 a-F - b740e3e5c05d | |
|
382 | 7 0 a-E - e9f537e46dea | |
|
383 | 6 0 n-B - 145e75495359 | |
|
384 | 5 0 n-A - d6bcb4f74035 | |
|
385 | 4 0 a-D - b555f63b6063 | |
|
386 | 3 0 a-C - 54acac6f23ab | |
|
387 | 2 0 b-A - f54f1bb90ff3 | |
|
388 | 1 0 a-B - 548a3d25dbf0 | |
|
389 | 0 0 a-A - 054250a37db4 | |
|
390 | ||
|
391 | Pushing to Publish=True (common changeset) | |
|
392 | ||
|
393 | $ cd ../beta | |
|
394 | $ hg push ../alpha | |
|
395 | pushing to ../alpha | |
|
396 | searching for changes | |
|
397 | no changes found | |
|
398 | $ hgph | |
|
399 | 6 0 a-F - b740e3e5c05d | |
|
400 | 5 0 a-E - e9f537e46dea | |
|
401 | 4 0 a-D - b555f63b6063 | |
|
402 | 3 0 a-C - 54acac6f23ab | |
|
403 | 2 0 b-A - f54f1bb90ff3 | |
|
404 | 1 0 a-B - 548a3d25dbf0 | |
|
405 | 0 0 a-A - 054250a37db4 | |
|
406 | $ cd ../alpha | |
|
407 | $ hgph # e9f537e46dea and b740e3e5c05d should have been sync to 0 | |
|
408 | 10 1 a-H - 967b449fbc94 | |
|
409 | 9 1 a-G - 3e27b6f1eee1 | |
|
410 | 8 0 a-F - b740e3e5c05d | |
|
411 | 7 0 a-E - e9f537e46dea | |
|
412 | 6 0 n-B - 145e75495359 | |
|
413 | 5 0 n-A - d6bcb4f74035 | |
|
414 | 4 0 b-A - f54f1bb90ff3 | |
|
415 | 3 0 a-D - b555f63b6063 | |
|
416 | 2 0 a-C - 54acac6f23ab | |
|
417 | 1 0 a-B - 548a3d25dbf0 | |
|
418 | 0 0 a-A - 054250a37db4 | |
|
419 | ||
|
420 | Pushing to Publish=False (common changeset that change phase + unknown one) | |
|
421 | ||
|
422 | $ hg push ../mu -r 967b449fbc94 -f | |
|
423 | pushing to ../mu | |
|
424 | searching for changes | |
|
425 | adding changesets | |
|
426 | adding manifests | |
|
427 | adding file changes | |
|
428 | added 1 changesets with 1 changes to 1 files (+1 heads) | |
|
429 | $ hgph | |
|
430 | 10 1 a-H - 967b449fbc94 | |
|
431 | 9 1 a-G - 3e27b6f1eee1 | |
|
432 | 8 0 a-F - b740e3e5c05d | |
|
433 | 7 0 a-E - e9f537e46dea | |
|
434 | 6 0 n-B - 145e75495359 | |
|
435 | 5 0 n-A - d6bcb4f74035 | |
|
436 | 4 0 b-A - f54f1bb90ff3 | |
|
437 | 3 0 a-D - b555f63b6063 | |
|
438 | 2 0 a-C - 54acac6f23ab | |
|
439 | 1 0 a-B - 548a3d25dbf0 | |
|
440 | 0 0 a-A - 054250a37db4 | |
|
441 | $ cd ../mu | |
|
442 | $ hgph # d6bcb4f74035 should have changed phase | |
|
443 | > # again d6bcb4f74035 and 145e75495359 changed because common was too smart | |
|
444 | 9 1 a-H - 967b449fbc94 | |
|
445 | 8 0 a-F - b740e3e5c05d | |
|
446 | 7 0 a-E - e9f537e46dea | |
|
447 | 6 0 n-B - 145e75495359 | |
|
448 | 5 0 n-A - d6bcb4f74035 | |
|
449 | 4 0 a-D - b555f63b6063 | |
|
450 | 3 0 a-C - 54acac6f23ab | |
|
451 | 2 0 b-A - f54f1bb90ff3 | |
|
452 | 1 0 a-B - 548a3d25dbf0 | |
|
453 | 0 0 a-A - 054250a37db4 | |
|
454 | ||
|
455 | ||
|
456 | Pushing to Publish=True (common changeset from publish=False) | |
|
457 | ||
|
458 | $ hg push ../alpha | |
|
459 | pushing to ../alpha | |
|
460 | searching for changes | |
|
461 | no changes found | |
|
462 | $ hgph | |
|
463 | 9 0 a-H - 967b449fbc94 | |
|
464 | 8 0 a-F - b740e3e5c05d | |
|
465 | 7 0 a-E - e9f537e46dea | |
|
466 | 6 0 n-B - 145e75495359 | |
|
467 | 5 0 n-A - d6bcb4f74035 | |
|
468 | 4 0 a-D - b555f63b6063 | |
|
469 | 3 0 a-C - 54acac6f23ab | |
|
470 | 2 0 b-A - f54f1bb90ff3 | |
|
471 | 1 0 a-B - 548a3d25dbf0 | |
|
472 | 0 0 a-A - 054250a37db4 | |
|
473 | $ hgph -R ../alpha # a-H should have been synced to 0 | |
|
474 | 10 0 a-H - 967b449fbc94 | |
|
475 | 9 1 a-G - 3e27b6f1eee1 | |
|
476 | 8 0 a-F - b740e3e5c05d | |
|
477 | 7 0 a-E - e9f537e46dea | |
|
478 | 6 0 n-B - 145e75495359 | |
|
479 | 5 0 n-A - d6bcb4f74035 | |
|
480 | 4 0 b-A - f54f1bb90ff3 | |
|
481 | 3 0 a-D - b555f63b6063 | |
|
482 | 2 0 a-C - 54acac6f23ab | |
|
483 | 1 0 a-B - 548a3d25dbf0 | |
|
484 | 0 0 a-A - 054250a37db4 | |
|
485 |
General Comments 0
You need to be logged in to leave comments.
Login now