Changeset - b20330417f57
[Not reviewed]
default
0 1 0
Mads Kiilerich - 12 years ago 2013-12-10 19:30:37
madski@unity3d.com
graph: stop looking for ancestors that have been passed - showing it as a "dead end" is better when the repo is very branchy
1 file changed with 11 insertions and 5 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/graphmod.py
Show inline comments
 
@@ -28,13 +28,14 @@ def _first_known_ancestors(parentrev_fun
 
    pending = set([head])
 
    seen = set()
 
    ancestors = set()
 
    while pending:
 
        r = pending.pop()
 
        if r < minrev:
 
            pass
 
            if r > nullrev: # ignore -1 returned from parentrev_func
 
                ancestors.add(-head) # fake unique unknown parent for this rev
 
        elif r in knownrevs:
 
            ancestors.add(r)
 
        elif r not in seen:
 
            pending.update(parentrev_func(r))
 
            seen.add(r)
 
    return ancestors
 
@@ -103,18 +104,23 @@ def _colored(dag):
 
        # Compute row and nextrow
 
        if rev not in row:
 
            row.append(rev)  # new head
 
            colors[rev] = newcolor
 
            newcolor += 1
 

	
 
        nextrow = row[:]
 
        col = row.index(rev)
 
        addparents = [p for p in dagparents if p not in row]
 

	
 
        # Add unknown parents to nextrow
 
        addparents = [p for p in dagparents if p not in nextrow]
 
        col = nextrow.index(rev)
 
        nextrow[col:col + 1] = addparents
 
        tmprow = row[:]
 
        tmprow[col:col + 1] = addparents
 
        # Stop looking for non-existing ancestors
 
        nextrow = []
 
        for r in tmprow:
 
            if r > nullrev or r in dagparents:
 
                nextrow.append(r)
 

	
 
        # Set colors for the parents
 
        color = colors.pop(rev)
 
        for i, p in enumerate(addparents):
 
            if not i:
 
                colors[p] = color
0 comments (0 inline, 0 general)