Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 15933:b8696a6676be
phases: only synchronize on common changeset when push fails
If push failed we should not expect the pushed changeset to exist on remote.
The common set before the push is used for phase related operation instead of
common + missing.
Note:
* We still pull phase data even if push fails
* We still try to push data even if push fails (same than bookmark)
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Thu, 19 Jan 2012 16:09:43 +0100 |
parents | 4154338f0bc0 |
children | ec8a9e06cf05 |
comparison
equal
deleted
inserted
replaced
15932:4154338f0bc0 | 15933:b8696a6676be |
---|---|
1620 if outgoing.excluded: | 1620 if outgoing.excluded: |
1621 msg = "no changes to push but %i secret changesets\n" | 1621 msg = "no changes to push but %i secret changesets\n" |
1622 self.ui.status(_(msg) % len(outgoing.excluded)) | 1622 self.ui.status(_(msg) % len(outgoing.excluded)) |
1623 else: | 1623 else: |
1624 self.ui.status(_("no changes found\n")) | 1624 self.ui.status(_("no changes found\n")) |
1625 fut = outgoing.common | |
1626 ret = 1 | 1625 ret = 1 |
1627 else: | 1626 else: |
1628 # something to push | 1627 # something to push |
1629 if not force: | 1628 if not force: |
1630 discovery.checkheads(self, remote, outgoing, | 1629 discovery.checkheads(self, remote, outgoing, |
1651 ret = remote.unbundle(cg, remoteheads, 'push') | 1650 ret = remote.unbundle(cg, remoteheads, 'push') |
1652 else: | 1651 else: |
1653 # we return an integer indicating remote head count change | 1652 # we return an integer indicating remote head count change |
1654 ret = remote.addchangegroup(cg, 'push', self.url()) | 1653 ret = remote.addchangegroup(cg, 'push', self.url()) |
1655 | 1654 |
1656 # compute what should be the now common | 1655 cheads = outgoing.commonheads[:] |
1657 # | 1656 if ret: |
1658 # XXX If push failed we should use strict common and not | 1657 # push succeed, synchonize common + pushed |
1659 # future to avoid pushing phase data on unknown changeset. | 1658 # this is a no-op if there was nothing to push |
1660 # This is to done later. | 1659 cheads += outgoing.missingheads |
1661 fut = outgoing.commonheads + outgoing.missingheads | |
1662 # even when we don't push, exchanging phase data is useful | 1660 # even when we don't push, exchanging phase data is useful |
1663 remotephases = remote.listkeys('phases') | 1661 remotephases = remote.listkeys('phases') |
1664 if not remotephases: # old server or public only repo | 1662 if not remotephases: # old server or public only repo |
1665 phases.advanceboundary(self, phases.public, fut) | 1663 phases.advanceboundary(self, phases.public, cheads) |
1666 # don't push any phase data as there is nothing to push | 1664 # don't push any phase data as there is nothing to push |
1667 else: | 1665 else: |
1668 ana = phases.analyzeremotephases(self, fut, remotephases) | 1666 ana = phases.analyzeremotephases(self, cheads, remotephases) |
1669 pheads, droots = ana | 1667 pheads, droots = ana |
1670 ### Apply remote phase on local | 1668 ### Apply remote phase on local |
1671 if remotephases.get('publishing', False): | 1669 if remotephases.get('publishing', False): |
1672 phases.advanceboundary(self, phases.public, fut) | 1670 phases.advanceboundary(self, phases.public, cheads) |
1673 else: # publish = False | 1671 else: # publish = False |
1674 phases.advanceboundary(self, phases.public, pheads) | 1672 phases.advanceboundary(self, phases.public, pheads) |
1675 phases.advanceboundary(self, phases.draft, fut) | 1673 phases.advanceboundary(self, phases.draft, cheads) |
1676 ### Apply local phase on remote | 1674 ### Apply local phase on remote |
1677 | 1675 |
1678 # Get the list of all revs draft on remote by public here. | 1676 # Get the list of all revs draft on remote by public here. |
1679 # XXX Beware that revset break if droots is not strictly | 1677 # XXX Beware that revset break if droots is not strictly |
1680 # XXX root we may want to ensure it is but it is costly | 1678 # XXX root we may want to ensure it is but it is costly |
1681 outdated = self.set('heads((%ln::%ln) and public())', | 1679 outdated = self.set('heads((%ln::%ln) and public())', |
1682 droots, fut) | 1680 droots, cheads) |
1683 for newremotehead in outdated: | 1681 for newremotehead in outdated: |
1684 r = remote.pushkey('phases', | 1682 r = remote.pushkey('phases', |
1685 newremotehead.hex(), | 1683 newremotehead.hex(), |
1686 str(phases.draft), | 1684 str(phases.draft), |
1687 str(phases.public)) | 1685 str(phases.public)) |