501 self.publish = publish |
501 self.publish = publish |
502 |
502 |
503 @util.propertycache |
503 @util.propertycache |
504 def futureheads(self): |
504 def futureheads(self): |
505 """future remote heads if the changeset push succeeds""" |
505 """future remote heads if the changeset push succeeds""" |
506 return self.outgoing.missingheads |
506 return self.outgoing.ancestorsof |
507 |
507 |
508 @util.propertycache |
508 @util.propertycache |
509 def fallbackheads(self): |
509 def fallbackheads(self): |
510 """future remote heads if the changeset push fails""" |
510 """future remote heads if the changeset push fails""" |
511 if self.revs is None: |
511 if self.revs is None: |
512 # not target to push, all common are relevant |
512 # not target to push, all common are relevant |
513 return self.outgoing.commonheads |
513 return self.outgoing.commonheads |
514 unfi = self.repo.unfiltered() |
514 unfi = self.repo.unfiltered() |
515 # I want cheads = heads(::missingheads and ::commonheads) |
515 # I want cheads = heads(::ancestorsof and ::commonheads) |
516 # (missingheads is revs with secret changeset filtered out) |
516 # (ancestorsof is revs with secret changeset filtered out) |
517 # |
517 # |
518 # This can be expressed as: |
518 # This can be expressed as: |
519 # cheads = ( (missingheads and ::commonheads) |
519 # cheads = ( (ancestorsof and ::commonheads) |
520 # + (commonheads and ::missingheads))" |
520 # + (commonheads and ::ancestorsof))" |
521 # ) |
521 # ) |
522 # |
522 # |
523 # while trying to push we already computed the following: |
523 # while trying to push we already computed the following: |
524 # common = (::commonheads) |
524 # common = (::commonheads) |
525 # missing = ((commonheads::missingheads) - commonheads) |
525 # missing = ((commonheads::ancestorsof) - commonheads) |
526 # |
526 # |
527 # We can pick: |
527 # We can pick: |
528 # * missingheads part of common (::commonheads) |
528 # * ancestorsof part of common (::commonheads) |
529 common = self.outgoing.common |
529 common = self.outgoing.common |
530 rev = self.repo.changelog.index.rev |
530 rev = self.repo.changelog.index.rev |
531 cheads = [node for node in self.revs if rev(node) in common] |
531 cheads = [node for node in self.revs if rev(node) in common] |
532 # and |
532 # and |
533 # * commonheads parents on missing |
533 # * commonheads parents on missing |
916 } |
916 } |
917 # If we are to push if there is at least one |
917 # If we are to push if there is at least one |
918 # obsolete or unstable changeset in missing, at |
918 # obsolete or unstable changeset in missing, at |
919 # least one of the missinghead will be obsolete or |
919 # least one of the missinghead will be obsolete or |
920 # unstable. So checking heads only is ok |
920 # unstable. So checking heads only is ok |
921 for node in outgoing.missingheads: |
921 for node in outgoing.ancestorsof: |
922 ctx = unfi[node] |
922 ctx = unfi[node] |
923 if ctx.obsolete(): |
923 if ctx.obsolete(): |
924 raise error.Abort(mso % ctx) |
924 raise error.Abort(mso % ctx) |
925 elif ctx.isunstable(): |
925 elif ctx.isunstable(): |
926 # TODO print more than one instability in the abort |
926 # TODO print more than one instability in the abort |
967 |
967 |
968 Exists as an independent function to aid extensions |
968 Exists as an independent function to aid extensions |
969 """ |
969 """ |
970 # * 'force' do not check for push race, |
970 # * 'force' do not check for push race, |
971 # * if we don't push anything, there are nothing to check. |
971 # * if we don't push anything, there are nothing to check. |
972 if not pushop.force and pushop.outgoing.missingheads: |
972 if not pushop.force and pushop.outgoing.ancestorsof: |
973 allowunrelated = b'related' in bundler.capabilities.get( |
973 allowunrelated = b'related' in bundler.capabilities.get( |
974 b'checkheads', () |
974 b'checkheads', () |
975 ) |
975 ) |
976 emptyremote = pushop.pushbranchmap is None |
976 emptyremote = pushop.pushbranchmap is None |
977 if not allowunrelated or emptyremote: |
977 if not allowunrelated or emptyremote: |