changeset 4343:b20330417f57

graph: stop looking for ancestors that have been passed - showing it as a "dead end" is better when the repo is very branchy
author Mads Kiilerich <madski@unity3d.com>
date Tue, 10 Dec 2013 19:30:37 +0100
parents efc911d7b217
children ed91b2993cde
files kallithea/lib/graphmod.py
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/graphmod.py	Tue Dec 10 19:30:37 2013 +0100
+++ b/kallithea/lib/graphmod.py	Tue Dec 10 19:30:37 2013 +0100
@@ -31,7 +31,8 @@
     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:
@@ -106,12 +107,17 @@
             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)