mercurial/discovery.py
branchstable
changeset 48796 c00d3ce4e94b
parent 48688 053a5bf508da
child 48875 6000f5b25c9b
equal deleted inserted replaced
48776:b84ff512b645 48796:c00d3ce4e94b
    17 
    17 
    18 from . import (
    18 from . import (
    19     bookmarks,
    19     bookmarks,
    20     branchmap,
    20     branchmap,
    21     error,
    21     error,
       
    22     obsolete,
    22     phases,
    23     phases,
    23     pycompat,
    24     pycompat,
    24     scmutil,
    25     scmutil,
    25     setdiscovery,
    26     setdiscovery,
    26     treediscovery,
    27     treediscovery,
   138     @util.propertycache
   139     @util.propertycache
   139     def missing(self):
   140     def missing(self):
   140         if self._missing is None:
   141         if self._missing is None:
   141             self._computecommonmissing()
   142             self._computecommonmissing()
   142         return self._missing
   143         return self._missing
   143 
       
   144     @property
       
   145     def missingheads(self):
       
   146         util.nouideprecwarn(
       
   147             b'outgoing.missingheads never contained what the name suggests and '
       
   148             b'was renamed to outgoing.ancestorsof. check your code for '
       
   149             b'correctness.',
       
   150             b'5.5',
       
   151             stacklevel=2,
       
   152         )
       
   153         return self.ancestorsof
       
   154 
   144 
   155 
   145 
   156 def findcommonoutgoing(
   146 def findcommonoutgoing(
   157     repo, other, onlyheads=None, force=False, commoninc=None, portable=False
   147     repo, other, onlyheads=None, force=False, commoninc=None, portable=False
   158 ):
   148 ):
   554 
   544 
   555     # fast path the simple case
   545     # fast path the simple case
   556     if len(localcandidate) == 1:
   546     if len(localcandidate) == 1:
   557         return unknownheads | set(candidate_newhs), set()
   547         return unknownheads | set(candidate_newhs), set()
   558 
   548 
       
   549     obsrevs = obsolete.getrevs(unfi, b'obsolete')
       
   550     futurenonobsolete = frozenset(futurecommon) - obsrevs
       
   551 
   559     # actually process branch replacement
   552     # actually process branch replacement
   560     while localcandidate:
   553     while localcandidate:
   561         nh = localcandidate.pop()
   554         nh = localcandidate.pop()
       
   555         r = torev(nh)
   562         current_branch = unfi[nh].branch()
   556         current_branch = unfi[nh].branch()
   563         # run this check early to skip the evaluation of the whole branch
   557         # run this check early to skip the evaluation of the whole branch
   564         if torev(nh) in futurecommon or ispublic(torev(nh)):
   558         if ispublic(r) or r not in obsrevs:
   565             newhs.add(nh)
   559             newhs.add(nh)
   566             continue
   560             continue
   567 
   561 
   568         # Get all revs/nodes on the branch exclusive to this head
   562         # Get all revs/nodes on the branch exclusive to this head
   569         # (already filtered heads are "ignored"))
   563         # (already filtered heads are "ignored"))
   581         # * any part of it is public,
   575         # * any part of it is public,
   582         # * any part of it is considered part of the result by previous logic,
   576         # * any part of it is considered part of the result by previous logic,
   583         # * if we have no markers to push to obsolete it.
   577         # * if we have no markers to push to obsolete it.
   584         if (
   578         if (
   585             any(ispublic(r) for r in branchrevs)
   579             any(ispublic(r) for r in branchrevs)
   586             or any(torev(n) in futurecommon for n in branchnodes)
   580             or any(torev(n) in futurenonobsolete for n in branchnodes)
   587             or any(not hasoutmarker(n) for n in branchnodes)
   581             or any(not hasoutmarker(n) for n in branchnodes)
   588         ):
   582         ):
   589             newhs.add(nh)
   583             newhs.add(nh)
   590         else:
   584         else:
   591             # note: there is a corner case if there is a merge in the branch.
   585             # note: there is a corner case if there is a merge in the branch.