mercurial/repoview.py
changeset 32475 1d70ec85ae00
parent 32427 8db2feb04ceb
child 32476 e5e31b0fc924
equal deleted inserted replaced
32474:c2b7fb580794 32475:1d70ec85ae00
    90                 seen.add(parent)
    90                 seen.add(parent)
    91                 if pre < len(seen) and getphase(repo, rev):
    91                 if pre < len(seen) and getphase(repo, rev):
    92                     heappush(heap, -parent)
    92                     heappush(heap, -parent)
    93     return hidden
    93     return hidden
    94 
    94 
       
    95 def _domainancestors(pfunc, revs, domain):
       
    96     """return ancestors of 'revs' within 'domain'
       
    97 
       
    98     - pfunc(r): a funtion returning parent of 'r',
       
    99     - revs: iterable of revnum,
       
   100     - domain: consistent set of revnum.
       
   101 
       
   102     The domain must be consistent: no connected subset are the ancestors of
       
   103     another connected subset. In other words, if the parents of a revision are
       
   104     not in the domains, no other ancestors of that revision. For example, with
       
   105     the following graph:
       
   106 
       
   107         F
       
   108         |
       
   109         E
       
   110         | D
       
   111         | |
       
   112         | C
       
   113         |/
       
   114         B
       
   115         |
       
   116         A
       
   117 
       
   118     If C, D, E and F are in the domain but B is not, A cannot be ((A) is an
       
   119     ancestors disconnected subset disconnected of (C+D)).
       
   120 
       
   121     (Ancestors are returned inclusively)
       
   122     """
       
   123     stack = list(revs)
       
   124     ancestors = set(stack)
       
   125     while stack:
       
   126         for p in pfunc(stack.pop()):
       
   127             if p != nullrev and p in domain and p not in ancestors:
       
   128                 ancestors.add(p)
       
   129                 stack.append(p)
       
   130     return ancestors
       
   131 
    95 cacheversion = 1
   132 cacheversion = 1
    96 cachefile = 'cache/hidden'
   133 cachefile = 'cache/hidden'
    97 
   134 
    98 def cachehash(repo, hideable):
   135 def cachehash(repo, hideable):
    99     """return sha1 hash of repository data to identify a valid cache.
   136     """return sha1 hash of repository data to identify a valid cache.