mercurial/revset.py
changeset 25308 036c26b08b71
parent 25307 4d1e56b29a91
child 25309 b333ca94403d
equal deleted inserted replaced
25307:4d1e56b29a91 25308:036c26b08b71
  2942         return None
  2942         return None
  2943 
  2943 
  2944     def __repr__(self):
  2944     def __repr__(self):
  2945         return '<%s %r>' % (type(self).__name__, self._subset)
  2945         return '<%s %r>' % (type(self).__name__, self._subset)
  2946 
  2946 
       
  2947 # this function will be removed, or merged to addset or orset, when
       
  2948 # - scmutil.revrange() can be rewritten to not combine calculated smartsets
       
  2949 # - or addset can handle more than two sets without balanced tree
       
  2950 def _combinesets(subsets):
       
  2951     """Create balanced tree of addsets representing union of given sets"""
       
  2952     if not subsets:
       
  2953         return baseset()
       
  2954     if len(subsets) == 1:
       
  2955         return subsets[0]
       
  2956     p = len(subsets) // 2
       
  2957     xs = _combinesets(subsets[:p])
       
  2958     ys = _combinesets(subsets[p:])
       
  2959     return addset(xs, ys)
       
  2960 
  2947 def _iterordered(ascending, iter1, iter2):
  2961 def _iterordered(ascending, iter1, iter2):
  2948     """produce an ordered iteration from two iterators with the same order
  2962     """produce an ordered iteration from two iterators with the same order
  2949 
  2963 
  2950     The ascending is used to indicated the iteration direction.
  2964     The ascending is used to indicated the iteration direction.
  2951     """
  2965     """