##// END OF EJS Templates
push: add --publish flag to change phase of pushed changesets...
av6 -
r40722:9b8d1ad8 default
parent child Browse files
Show More
@@ -4497,6 +4497,7 b' def pull(ui, repo, source="default", **o'
4497 4497 _('a specific branch you would like to push'), _('BRANCH')),
4498 4498 ('', 'new-branch', False, _('allow pushing a new branch')),
4499 4499 ('', 'pushvars', [], _('variables that can be sent to server (ADVANCED)')),
4500 ('', 'publish', False, _('push the changeset as public (EXPERIMENTAL)')),
4500 4501 ] + remoteopts,
4501 4502 _('[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]'),
4502 4503 helpcategory=command.CATEGORY_REMOTE_REPO_MANAGEMENT,
@@ -4614,6 +4615,7 b' def push(ui, repo, dest=None, **opts):'
4614 4615 pushop = exchange.push(repo, other, opts.get('force'), revs=revs,
4615 4616 newbranch=opts.get('new_branch'),
4616 4617 bookmarks=opts.get('bookmark', ()),
4618 publish=opts.get('publish'),
4617 4619 opargs=opargs)
4618 4620
4619 4621 result = not pushop.cgresult
@@ -359,7 +359,7 b' class pushoperation(object):'
359 359 """
360 360
361 361 def __init__(self, repo, remote, force=False, revs=None, newbranch=False,
362 bookmarks=(), pushvars=None):
362 bookmarks=(), publish=False, pushvars=None):
363 363 # repo we push from
364 364 self.repo = repo
365 365 self.ui = repo.ui
@@ -421,6 +421,8 b' class pushoperation(object):'
421 421 self.pkfailcb = {}
422 422 # an iterable of pushvars or None
423 423 self.pushvars = pushvars
424 # publish pushed changesets
425 self.publish = publish
424 426
425 427 @util.propertycache
426 428 def futureheads(self):
@@ -478,7 +480,7 b' bookmsgmap = {\'update\': (_("updating boo'
478 480
479 481
480 482 def push(repo, remote, force=False, revs=None, newbranch=False, bookmarks=(),
481 opargs=None):
483 publish=False, opargs=None):
482 484 '''Push outgoing changesets (limited by revs) from a local
483 485 repository to remote. Return an integer:
484 486 - None means nothing to push
@@ -490,7 +492,7 b' def push(repo, remote, force=False, revs'
490 492 if opargs is None:
491 493 opargs = {}
492 494 pushop = pushoperation(repo, remote, force, revs, newbranch, bookmarks,
493 **pycompat.strkwargs(opargs))
495 publish, **pycompat.strkwargs(opargs))
494 496 if pushop.remote.local():
495 497 missing = (set(pushop.repo.requirements)
496 498 - pushop.remote.local().supported)
@@ -630,7 +632,10 b' def _pushdiscoveryphase(pushop):'
630 632 # XXX Beware that revset break if droots is not strictly
631 633 # XXX root we may want to ensure it is but it is costly
632 634 fallback = list(unfi.set(revset, droots, pushop.fallbackheads))
633 if not outgoing.missing:
635 if not pushop.remotephases.publishing and pushop.publish:
636 future = list(unfi.set('%ln and (not public() or %ln::)',
637 pushop.futureheads, droots))
638 elif not outgoing.missing:
634 639 future = fallback
635 640 else:
636 641 # adds changeset we are going to push as draft
@@ -325,7 +325,7 b' Show all commands + options'
325 325 paths: template
326 326 phase: public, draft, secret, force, rev
327 327 pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure
328 push: force, rev, bookmark, branch, new-branch, pushvars, ssh, remotecmd, insecure
328 push: force, rev, bookmark, branch, new-branch, pushvars, publish, ssh, remotecmd, insecure
329 329 recover:
330 330 remove: after, force, subrepos, include, exclude, dry-run
331 331 rename: after, force, include, exclude, dry-run
@@ -1559,3 +1559,194 b' of phase heads computation)'
1559 1559 |
1560 1560 o 426ba public
1561 1561
1562 $ killdaemons.py
1563
1564
1565 --publish flag
1566 --------------
1567
1568 $ hg init doesnt-publish
1569 $ cd doesnt-publish
1570 $ cat > .hg/hgrc << EOF
1571 > [phases]
1572 > publish=0
1573 > EOF
1574 $ mkcommit orig-root
1575 test-debug-phase: new rev 0: x -> 1
1576 $ hg phase --public -r 'all()'
1577 test-debug-phase: move rev 0: 1 -> 0
1578 $ cd ..
1579
1580 $ hg clone -q doesnt-publish client
1581 $ cd client
1582
1583 pushing nothing
1584
1585 $ mkcommit new-A
1586 test-debug-phase: new rev 1: x -> 1
1587 $ mkcommit new-B
1588 test-debug-phase: new rev 2: x -> 1
1589 $ hg push --publish -r null
1590 pushing to $TESTTMP/doesnt-publish
1591 searching for changes
1592 no changes found
1593 [1]
1594 $ hgph
1595 @ 2 draft new-B - 89512e87d697
1596 |
1597 o 1 draft new-A - 4826e44e690e
1598 |
1599 o 0 public orig-root - c48edaf99a10
1600
1601
1602 pushing a new changeset (selective)
1603
1604 $ hg push --publish -r 'desc("new-A")'
1605 pushing to $TESTTMP/doesnt-publish
1606 searching for changes
1607 adding changesets
1608 adding manifests
1609 adding file changes
1610 added 1 changesets with 1 changes to 1 files
1611 test-debug-phase: new rev 1: x -> 0
1612 test-debug-phase: move rev 1: 1 -> 0
1613 $ hgph
1614 @ 2 draft new-B - 89512e87d697
1615 |
1616 o 1 public new-A - 4826e44e690e
1617 |
1618 o 0 public orig-root - c48edaf99a10
1619
1620
1621 pushing a new changeset (linear)
1622
1623 $ hg push --publish
1624 pushing to $TESTTMP/doesnt-publish
1625 searching for changes
1626 adding changesets
1627 adding manifests
1628 adding file changes
1629 added 1 changesets with 1 changes to 1 files
1630 test-debug-phase: new rev 2: x -> 0
1631 test-debug-phase: move rev 2: 1 -> 0
1632 $ hgph
1633 @ 2 public new-B - 89512e87d697
1634 |
1635 o 1 public new-A - 4826e44e690e
1636 |
1637 o 0 public orig-root - c48edaf99a10
1638
1639
1640 pushing new changesets (different branches)
1641
1642 $ mkcommit new-C
1643 test-debug-phase: new rev 3: x -> 1
1644 $ hg update -q '.^'
1645 $ hg branch -q another
1646 $ mkcommit new-D
1647 test-debug-phase: new rev 4: x -> 1
1648 $ hg push --new-branch --publish
1649 pushing to $TESTTMP/doesnt-publish
1650 searching for changes
1651 adding changesets
1652 adding manifests
1653 adding file changes
1654 added 2 changesets with 2 changes to 2 files (+1 heads)
1655 test-debug-phase: new rev 3: x -> 0
1656 test-debug-phase: new rev 4: x -> 0
1657 test-debug-phase: move rev 3: 1 -> 0
1658 test-debug-phase: move rev 4: 1 -> 0
1659 $ hgph
1660 @ 4 public new-D - 5e53dcafd13c
1661 |
1662 | o 3 public new-C - 1665482cc06d
1663 |/
1664 o 2 public new-B - 89512e87d697
1665 |
1666 o 1 public new-A - 4826e44e690e
1667 |
1668 o 0 public orig-root - c48edaf99a10
1669
1670
1671 pushing a shared changeset
1672
1673 $ mkcommit new-E
1674 test-debug-phase: new rev 5: x -> 1
1675 $ hg push
1676 pushing to $TESTTMP/doesnt-publish
1677 searching for changes
1678 adding changesets
1679 adding manifests
1680 adding file changes
1681 added 1 changesets with 1 changes to 1 files
1682 test-debug-phase: new rev 5: x -> 1
1683 $ hg push --publish
1684 pushing to $TESTTMP/doesnt-publish
1685 searching for changes
1686 no changes found
1687 test-debug-phase: move rev 5: 1 -> 0
1688 test-debug-phase: move rev 5: 1 -> 0
1689 [1]
1690 $ hgph
1691 @ 5 public new-E - 48931ee3529c
1692 |
1693 o 4 public new-D - 5e53dcafd13c
1694 |
1695 | o 3 public new-C - 1665482cc06d
1696 |/
1697 o 2 public new-B - 89512e87d697
1698 |
1699 o 1 public new-A - 4826e44e690e
1700 |
1701 o 0 public orig-root - c48edaf99a10
1702
1703 $ cd ..
1704
1705 --publish with subrepos (doesn't propagate to subrepos currently)
1706
1707 $ hg init with-subrepo
1708 $ cd with-subrepo
1709 $ cat > .hg/hgrc << EOF
1710 > [phases]
1711 > publish=0
1712 > EOF
1713 $ hg init subrepo
1714 $ cd subrepo
1715 $ cat > .hg/hgrc << EOF
1716 > [phases]
1717 > publish=0
1718 > EOF
1719 $ echo foo > foo
1720 $ hg ci -qAm0
1721 test-debug-phase: new rev 0: x -> 1
1722 $ cd ..
1723 $ echo 'subrepo = subrepo' > .hgsub
1724 $ hg add .hgsub
1725 $ hg ci -m 'Adding subrepo'
1726 test-debug-phase: new rev 0: x -> 1
1727 $ hgph
1728 @ 0 draft Adding subrepo - 74d5b62379c0
1729
1730 $ hgph -R subrepo
1731 @ 0 draft 0 - 4b3f578e3344
1732
1733 $ cd ..
1734 $ hg clone with-subrepo client-with-subrepo
1735 updating to branch default
1736 cloning subrepo subrepo from $TESTTMP/with-subrepo/subrepo
1737 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1738 $ cd client-with-subrepo
1739 $ hg push --publish
1740 pushing to $TESTTMP/with-subrepo
1741 no changes made to subrepo subrepo since last push to $TESTTMP/with-subrepo/subrepo
1742 searching for changes
1743 no changes found
1744 test-debug-phase: move rev 0: 1 -> 0
1745 test-debug-phase: move rev 0: 1 -> 0
1746 [1]
1747 $ hgph
1748 @ 0 public Adding subrepo - 74d5b62379c0
1749
1750 $ hgph -R subrepo
1751 @ 0 draft 0 - 4b3f578e3344
1752
General Comments 0
You need to be logged in to leave comments. Login now