##// END OF EJS Templates
push: prevent moving phases outside of the pushed subset
Pierre-Yves David -
r15956:5653f2d1 stable
parent child Browse files
Show More
@@ -1554,21 +1554,29 b' class localrepository(repo.repository):'
1554 1554 clend = len(self.changelog)
1555 1555 added = [self.changelog.node(r) for r in xrange(clstart, clend)]
1556 1556
1557 # compute target subset
1558 if heads is None:
1559 # We pulled every thing possible
1560 # sync on everything common
1561 subset = common + added
1562 else:
1563 # We pulled a specific subset
1564 # sync on this subset
1565 subset = heads
1557 1566
1558 1567 # Get remote phases data from remote
1559 1568 remotephases = remote.listkeys('phases')
1560 1569 publishing = bool(remotephases.get('publishing', False))
1561 1570 if remotephases and not publishing:
1562 1571 # remote is new and unpublishing
1563 subset = common + added
1564 1572 pheads, _dr = phases.analyzeremotephases(self, subset,
1565 1573 remotephases)
1566 1574 phases.advanceboundary(self, phases.public, pheads)
1567 phases.advanceboundary(self, phases.draft, common + added)
1575 phases.advanceboundary(self, phases.draft, subset)
1568 1576 else:
1569 1577 # Remote is old or publishing all common changesets
1570 1578 # should be seen as public
1571 phases.advanceboundary(self, phases.public, common + added)
1579 phases.advanceboundary(self, phases.public, subset)
1572 1580 finally:
1573 1581 lock.release()
1574 1582
@@ -1652,11 +1660,35 b' class localrepository(repo.repository):'
1652 1660 # we return an integer indicating remote head count change
1653 1661 ret = remote.addchangegroup(cg, 'push', self.url())
1654 1662
1655 cheads = outgoing.commonheads[:]
1656 1663 if ret:
1657 # push succeed, synchonize common + pushed
1658 # this is a no-op if there was nothing to push
1659 cheads += outgoing.missingheads
1664 # push succeed, synchonize target of the push
1665 cheads = outgoing.missingheads
1666 elif revs is None:
1667 # All out push fails. synchronize all common
1668 cheads = outgoing.commonheads
1669 else:
1670 # I want cheads = heads(::missingheads and ::commonheads)
1671 # (missingheads is revs with secret changeset filtered out)
1672 #
1673 # This can be expressed as:
1674 # cheads = ( (missingheads and ::commonheads)
1675 # + (commonheads and ::missingheads))"
1676 # )
1677 #
1678 # while trying to push we already computed the following:
1679 # common = (::commonheads)
1680 # missing = ((commonheads::missingheads) - commonheads)
1681 #
1682 # We can pick:
1683 # * missingheads part of comon (::commonheads)
1684 common = set(outgoing.common)
1685 cheads = [n for node in revs if n in common]
1686 # and
1687 # * commonheads parents on missing
1688 rvset = repo.revset('%ln and parents(roots(%ln))',
1689 outgoing.commonheads,
1690 outgoing.missing)
1691 cheads.extend(c.node() for c in rvset)
1660 1692 # even when we don't push, exchanging phase data is useful
1661 1693 remotephases = remote.listkeys('phases')
1662 1694 if not remotephases: # old server or public only repo
@@ -179,7 +179,6 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
183 182 exporting bookmark foo
184 183 pushkey hook: HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_RET=1
185 184 $ cd ../a
@@ -193,7 +192,7 b' listkeys hook'
193 192 pulling from ../a
194 193 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
195 194 no changes found
196 listkeys hook: HG_NAMESPACE=phases HG_VALUES={'539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10': '1', 'publishing': 'True'}
195 listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
197 196 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
198 197 importing bookmark bar
199 198 $ cd ../a
@@ -207,7 +206,7 b' test that prepushkey can prevent incomin'
207 206 pushing to ../a
208 207 searching for changes
209 208 no changes found
210 listkeys hook: HG_NAMESPACE=phases HG_VALUES={'539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10': '1', 'publishing': 'True'}
209 listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
211 210 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
212 211 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
213 212 exporting bookmark baz
@@ -238,10 +238,10 b' we are in nu'
238 238 adding file changes
239 239 added 1 changesets with 1 changes to 1 files
240 240 (run 'hg update' to get a working copy)
241 $ hgph
241 $ hgph # f54f1bb90ff3 stay draft, not ancestor of -r
242 242 o 4 public a-D - b555f63b6063
243 243 |
244 | o 3 public b-A - f54f1bb90ff3
244 | o 3 draft b-A - f54f1bb90ff3
245 245 | |
246 246 o | 2 public a-C - 54acac6f23ab
247 247 |/
@@ -262,7 +262,7 b' pulling from Publish=False to publish=Fa'
262 262 |
263 263 | o 4 public a-D - b555f63b6063
264 264 | |
265 o | 3 public b-A - f54f1bb90ff3
265 o | 3 draft b-A - f54f1bb90ff3
266 266 | |
267 267 | o 2 public a-C - 54acac6f23ab
268 268 |/
@@ -288,7 +288,7 b' pulling from Publish=False to publish=Fa'
288 288 | |
289 289 | o 3 public a-C - 54acac6f23ab
290 290 | |
291 o | 2 public b-A - f54f1bb90ff3
291 o | 2 draft b-A - f54f1bb90ff3
292 292 |/
293 293 o 1 public a-B - 548a3d25dbf0
294 294 |
@@ -497,20 +497,21 b' Pushing to Publish=False (unknown change'
497 497
498 498
499 499 $ cd ../mu
500 $ hgph # d6bcb4f74035 and 145e75495359 changed because common is too smart
500 $ hgph # again f54f1bb90ff3, d6bcb4f74035 and 145e75495359 stay draft,
501 > # not ancestor of -r
501 502 o 8 draft a-F - b740e3e5c05d
502 503 |
503 504 o 7 draft a-E - e9f537e46dea
504 505 |
505 | o 6 public n-B - 145e75495359
506 | o 6 draft n-B - 145e75495359
506 507 | |
507 | o 5 public n-A - d6bcb4f74035
508 | o 5 draft n-A - d6bcb4f74035
508 509 | |
509 510 o | 4 public a-D - b555f63b6063
510 511 | |
511 512 o | 3 public a-C - 54acac6f23ab
512 513 | |
513 | o 2 public b-A - f54f1bb90ff3
514 | o 2 draft b-A - f54f1bb90ff3
514 515 |/
515 516 o 1 public a-B - 548a3d25dbf0
516 517 |
@@ -526,20 +527,21 b' Pushing to Publish=True (unknown changes'
526 527 adding manifests
527 528 adding file changes
528 529 added 2 changesets with 2 changes to 2 files
529 $ hgph # again d6bcb4f74035 and 145e75495359 changed because common is too smart
530 $ hgph # again f54f1bb90ff3, d6bcb4f74035 and 145e75495359 stay draft,
531 > # not ancestor of -r
530 532 o 8 public a-F - b740e3e5c05d
531 533 |
532 534 o 7 public a-E - e9f537e46dea
533 535 |
534 | o 6 public n-B - 145e75495359
536 | o 6 draft n-B - 145e75495359
535 537 | |
536 | o 5 public n-A - d6bcb4f74035
538 | o 5 draft n-A - d6bcb4f74035
537 539 | |
538 540 o | 4 public a-D - b555f63b6063
539 541 | |
540 542 o | 3 public a-C - 54acac6f23ab
541 543 | |
542 | o 2 public b-A - f54f1bb90ff3
544 | o 2 draft b-A - f54f1bb90ff3
543 545 |/
544 546 o 1 public a-B - 548a3d25dbf0
545 547 |
@@ -569,7 +571,7 b' Pushing to Publish=True (common changese'
569 571 o 0 public a-A - 054250a37db4
570 572
571 573 $ cd ../alpha
572 $ hgph # e9f537e46dea and b740e3e5c05d should have been sync to 0
574 $ hgph
573 575 @ 10 draft a-H - 967b449fbc94
574 576 |
575 577 | o 9 draft a-G - 3e27b6f1eee1
@@ -627,14 +629,14 b' Pushing to Publish=False (common changes'
627 629
628 630 $ cd ../mu
629 631 $ hgph # d6bcb4f74035 should have changed phase
630 > # again d6bcb4f74035 and 145e75495359 changed because common was too smart
632 > # 145e75495359 is still draft. not ancestor of -r
631 633 o 9 draft a-H - 967b449fbc94
632 634 |
633 635 | o 8 public a-F - b740e3e5c05d
634 636 | |
635 637 | o 7 public a-E - e9f537e46dea
636 638 | |
637 +---o 6 public n-B - 145e75495359
639 +---o 6 draft n-B - 145e75495359
638 640 | |
639 641 o | 5 public n-A - d6bcb4f74035
640 642 | |
General Comments 0
You need to be logged in to leave comments. Login now