Mercurial > public > mercurial-scm > hg
comparison mercurial/exchange.py @ 45144:c93dd9d9f1e6
discovery: change users of `outgoing.missingheads` to `outgoing.ancestorsof`
The attribute `missingheads` was recently renamed to `ancestorsof`, as it,
despite the old name, doesn?t contain the missing heads but the changesets that
were requested (including ancestors) for the outgoing operation.
Changing all the users enables to print a warning if the old name is used.
There is a good chance that some of the users are buggy because of the old name.
Changing them to use the new name makes it more obvious that they are buggy. All
users need to be reviewed for bugs. When sending patches for fixing them, the
change will be more obvious without having to explain again and again the
discrepancy of the old attribute name and what it actually contained.
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Fri, 17 Jul 2020 09:20:48 +0200 |
parents | b1e51ef4e536 |
children | c26335fa4225 |
comparison
equal
deleted
inserted
replaced
45143:5631b0116374 | 45144:c93dd9d9f1e6 |
---|---|
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: |