hgext3rd/evolve/obshistory.py
changeset 5052 b9a7fb0a0a49
parent 4983 6d40e0166522
child 5053 196ed65594dc
equal deleted inserted replaced
5051:9346f0e934be 5052:b9a7fb0a0a49
   832         lines = next(iterdiff)
   832         lines = next(iterdiff)
   833     except StopIteration:
   833     except StopIteration:
   834         return None
   834         return None
   835     return _prepare_hunk(lines)
   835     return _prepare_hunk(lines)
   836 
   836 
   837 def _getobsfate(successorssets):
       
   838     """ Compute a changeset obsolescence fate based on his successorssets.
       
   839     Successors can be the tipmost ones or the immediate ones.
       
   840     Returns one fate in the following list:
       
   841     - pruned
       
   842     - diverged
       
   843     - superseed
       
   844     - superseed_split
       
   845     """
       
   846 
       
   847     if len(successorssets) == 0:
       
   848         # The commit has been pruned
       
   849         return b'pruned'
       
   850     elif len(successorssets) > 1:
       
   851         return b'diverged'
       
   852     else:
       
   853         # No divergence, only one set of successors
       
   854         successors = successorssets[0]
       
   855 
       
   856         if len(successors) == 1:
       
   857             return b'superseed'
       
   858         else:
       
   859             return b'superseed_split'
       
   860 
       
   861 def _getobsfateandsuccs(repo, revnode, successorssets=None):
   837 def _getobsfateandsuccs(repo, revnode, successorssets=None):
   862     """ Return a tuple containing:
   838     """ Return a tuple containing:
   863     - the reason a revision is obsolete (diverged, pruned or superseed)
   839     - the reason a revision is obsolete (diverged, pruned or superseed)
   864     - the list of successors short node if the revision is neither pruned
   840     - the list of successors short node if the revision is neither pruned
   865     or has diverged
   841     or has diverged
   866     """
   842     """
   867     if successorssets is None:
   843     if successorssets is None:
   868         successorssets = obsutil.successorssets(repo, revnode)
   844         successorssets = obsutil.successorssets(repo, revnode)
   869 
   845 
   870     fate = _getobsfate(successorssets)
   846     fate = obsutil._getobsfate(successorssets)
   871 
   847 
   872     # Apply node.short if we have no divergence
   848     # Apply node.short if we have no divergence
   873     if len(successorssets) == 1:
   849     if len(successorssets) == 1:
   874         successors = [nodemod.short(node_id) for node_id in successorssets[0]]
   850         successors = [nodemod.short(node_id) for node_id in successorssets[0]]
   875     else:
   851     else: